mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
When talking to an HTTP2 server, there are situations where it needs to
"rewind" the Request.Body. To allow this, we have to set up the Request.GetBody
function to return a brand new instance of the body.
If not set, we can end up with the following error:
http2: Transport: cannot retry err [http2: Transport received Server's graceful shutdown GOAWAY] after Request.Body was written; define Request.GetBody to avoid this error
See this commit for more information: cffdcf672a
Co-authored-by: Valentin Trinqué <ValentinTrinque@users.noreply.github.com>
This commit is contained in:
parent
d751e88fa5
commit
007314980f
1 changed files with 1 additions and 0 deletions
|
|
@ -183,6 +183,7 @@ func (hc *httpConn) doRequest(ctx context.Context, msg interface{}) (io.ReadClos
|
|||
return nil, err
|
||||
}
|
||||
req.ContentLength = int64(len(body))
|
||||
req.GetBody = func() (io.ReadCloser, error) { return io.NopCloser(bytes.NewReader(body)), nil }
|
||||
|
||||
// set headers
|
||||
hc.mu.Lock()
|
||||
|
|
|
|||
Loading…
Reference in a new issue