Patch for concurrent iterator & others (onto v1.11.6) #386
@ -747,7 +747,7 @@ func authTwitter(url string, tokenV1, tokenV2 string) (string, string, string, c
|
||||
func authTwitterWithTokenV1(tweetID string, token string) (string, string, string, common.Address, error) {
|
||||
// Query the tweet details from Twitter
|
||||
url := fmt.Sprintf("https://api.twitter.com/1.1/statuses/show.json?id=%s", tweetID)
|
||||
req, err := http.NewRequest("GET", url, nil)
|
||||
req, err := http.NewRequest(http.MethodGet, url, nil)
|
||||
if err != nil {
|
||||
return "", "", "", common.Address{}, err
|
||||
}
|
||||
@ -784,7 +784,7 @@ func authTwitterWithTokenV1(tweetID string, token string) (string, string, strin
|
||||
func authTwitterWithTokenV2(tweetID string, token string) (string, string, string, common.Address, error) {
|
||||
// Query the tweet details from Twitter
|
||||
url := fmt.Sprintf("https://api.twitter.com/2/tweets/%s?expansions=author_id&user.fields=profile_image_url", tweetID)
|
||||
req, err := http.NewRequest("GET", url, nil)
|
||||
req, err := http.NewRequest(http.MethodGet, url, nil)
|
||||
if err != nil {
|
||||
return "", "", "", common.Address{}, err
|
||||
}
|
||||
|
@ -379,7 +379,7 @@ func (s *remoteSealer) notifyWork() {
|
||||
func (s *remoteSealer) sendNotification(ctx context.Context, url string, json []byte, work [4]string) {
|
||||
defer s.reqWG.Done()
|
||||
|
||||
req, err := http.NewRequest("POST", url, bytes.NewReader(json))
|
||||
req, err := http.NewRequest(http.MethodPost, url, bytes.NewReader(json))
|
||||
if err != nil {
|
||||
s.ethash.config.Log.Warn("Can't create remote miner notification", "err", err)
|
||||
return
|
||||
|
@ -48,7 +48,7 @@ func errorJSON(msg string) []byte {
|
||||
}
|
||||
|
||||
func (h GraphiQL) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method != "GET" {
|
||||
if r.Method != http.MethodGet {
|
||||
respond(w, errorJSON("only GET requests are supported"), http.StatusMethodNotAllowed)
|
||||
return
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ func (c *LibratoClient) PostMetrics(batch Batch) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
if req, err = http.NewRequest("POST", MetricsPostUrl, bytes.NewBuffer(js)); err != nil {
|
||||
if req, err = http.NewRequest(http.MethodPost, MetricsPostUrl, bytes.NewBuffer(js)); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -167,7 +167,7 @@ func TestWebsocketOrigins(t *testing.T) {
|
||||
|
||||
// TestIsWebsocket tests if an incoming websocket upgrade request is handled properly.
|
||||
func TestIsWebsocket(t *testing.T) {
|
||||
r, _ := http.NewRequest("GET", "/", nil)
|
||||
r, _ := http.NewRequest(http.MethodGet, "/", nil)
|
||||
|
||||
assert.False(t, isWebsocket(r))
|
||||
r.Header.Set("upgrade", "websocket")
|
||||
@ -294,7 +294,7 @@ func baseRpcRequest(t *testing.T, url, bodyStr string, extraHeaders ...string) *
|
||||
|
||||
// Create the request.
|
||||
body := bytes.NewReader([]byte(bodyStr))
|
||||
req, err := http.NewRequest("POST", url, body)
|
||||
req, err := http.NewRequest(http.MethodPost, url, body)
|
||||
if err != nil {
|
||||
t.Fatal("could not create http request:", err)
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ type SubscribeOpts struct {
|
||||
// nodes and connections and filtering message events
|
||||
func (c *Client) SubscribeNetwork(events chan *Event, opts SubscribeOpts) (event.Subscription, error) {
|
||||
url := fmt.Sprintf("%s/events?current=%t&filter=%s", c.URL, opts.Current, opts.Filter)
|
||||
req, err := http.NewRequest("GET", url, nil)
|
||||
req, err := http.NewRequest(http.MethodGet, url, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -215,18 +215,18 @@ func (c *Client) RPCClient(ctx context.Context, nodeID string) (*rpc.Client, err
|
||||
// Get performs a HTTP GET request decoding the resulting JSON response
|
||||
// into "out"
|
||||
func (c *Client) Get(path string, out interface{}) error {
|
||||
return c.Send("GET", path, nil, out)
|
||||
return c.Send(http.MethodGet, path, nil, out)
|
||||
}
|
||||
|
||||
// Post performs a HTTP POST request sending "in" as the JSON body and
|
||||
// decoding the resulting JSON response into "out"
|
||||
func (c *Client) Post(path string, in, out interface{}) error {
|
||||
return c.Send("POST", path, in, out)
|
||||
return c.Send(http.MethodPost, path, in, out)
|
||||
}
|
||||
|
||||
// Delete performs a HTTP DELETE request
|
||||
func (c *Client) Delete(path string) error {
|
||||
return c.Send("DELETE", path, nil, nil)
|
||||
return c.Send(http.MethodDelete, path, nil, nil)
|
||||
}
|
||||
|
||||
// Send performs a HTTP request, sending "in" as the JSON request body and
|
||||
|
@ -209,7 +209,7 @@ func (hc *httpConn) doRequest(ctx context.Context, msg interface{}) (io.ReadClos
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
req, err := http.NewRequestWithContext(ctx, "POST", hc.url, io.NopCloser(bytes.NewReader(body)))
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodPost, hc.url, io.NopCloser(bytes.NewReader(body)))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user