@@ -19,8 +19,6 @@ import (
1919
2020 "github.com/blang/semver"
2121 "github.com/tebeka/selenium/firefox"
22- "github.com/tebeka/selenium/http/headers"
23- "github.com/tebeka/selenium/http/mediatypes"
2422 "github.com/tebeka/selenium/log"
2523)
2624
@@ -61,15 +59,18 @@ type remoteWD struct {
6159// server.
6260var HTTPClient = http .DefaultClient
6361
62+ // jsonContentType is JSON content type.
63+ const jsonContentType = "application/json"
64+
6465func newRequest (method string , url string , data []byte ) (* http.Request , error ) {
6566 request , err := http .NewRequest (method , url , bytes .NewBuffer (data ))
6667 if err != nil {
6768 return nil , err
6869 }
6970 if data != nil {
70- request .Header .Add (headers . ContentType , mediatypes . ApplicationJSONUtf8 )
71+ request .Header .Add ("Content-Type" , jsonContentType )
7172 }
72- request .Header .Add (headers . Accept , mediatypes . ApplicationJSON )
73+ request .Header .Add (" Accept" , jsonContentType )
7374
7475 return request , nil
7576}
@@ -150,19 +151,19 @@ func executeCommand(method, url string, data []byte) (json.RawMessage, error) {
150151 buf = prettyBuf .Bytes ()
151152 }
152153 }
153- debugLog ("<- %s [%s]\n %s" , response .Status , response .Header [headers . ContentType ], buf )
154+ debugLog ("<- %s [%s]\n %s" , response .Status , response .Header ["Content-Type" ], buf )
154155 }
155156 if err != nil {
156157 return nil , errors .New (response .Status )
157158 }
158159
159- fullCType := response .Header .Get (headers . ContentType )
160+ fullCType := response .Header .Get ("Content-Type" )
160161 cType , _ , err := mime .ParseMediaType (fullCType )
161162 if err != nil {
162- return nil , fmt .Errorf ("got content type header %q, expected %q" , fullCType , mediatypes . ApplicationJSON )
163+ return nil , fmt .Errorf ("got content type header %q, expected %q" , fullCType , jsonContentType )
163164 }
164- if cType != mediatypes . ApplicationJSON {
165- return nil , fmt .Errorf ("got content type %q, expected %q" , cType , mediatypes . ApplicationJSON )
165+ if cType != jsonContentType {
166+ return nil , fmt .Errorf ("got content type %q, expected %q" , cType , jsonContentType )
166167 }
167168
168169 reply := new (serverReply )
0 commit comments