Skip to content

Commit d5cdc50

Browse files
With golangci-lint v2.2.2 using http.NewRequest is discouraged (#4136)
1 parent d9d6f59 commit d5cdc50

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

vms/rpcchainvm/ghttp/http_server.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,12 @@ func (s *Server) Handle(ctx context.Context, req *httppb.HTTPRequest) (*httppb.H
153153
// HandleSimple handles http requests over http2 using a simple request response model.
154154
// Websockets are not supported.
155155
func (s *Server) HandleSimple(ctx context.Context, r *httppb.HandleSimpleHTTPRequest) (*httppb.HandleSimpleHTTPResponse, error) {
156-
req, err := http.NewRequest(r.Method, r.Url, bytes.NewBuffer(r.Body))
156+
req, err := http.NewRequestWithContext(ctx, r.Method, r.Url, bytes.NewBuffer(r.Body))
157157
if err != nil {
158158
return nil, err
159159
}
160160

161161
grpcutils.SetHeaders(req.Header, r.RequestHeaders)
162-
163-
req = req.WithContext(ctx)
164162
req.RequestURI = r.Url
165163
req.ContentLength = int64(len(r.Body))
166164

0 commit comments

Comments
 (0)