Closed fatedier closed 3 years ago
This makes sense to me. Can we add a test that has a timeout and assert that the returned error meets the network Error interface and marks it as a timeout. In the comment of that test can you describe the reason we need this.
OK. I will add a test.
Thanks for the contribution @fatedier
Fix #90
Golang standard http server package will read from connections in background to detect if it's alive. It set read deadline on connection and detect if the returned error is timeout error which implements net.Error.
If not, it will call
cr.handleReadError(err)
and then callcr.conn.cancelCtx()
, so serverrequest.Context()
will be canceled too.We'd better let ErrTimeout defined in consts.go to satisfy
net.Error
interface, so everything will be ok.cc @mitchellh @dadgar