You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in go1.6rc2, the reference code returns a nil error and a valid response object with a 200 status code.
in go1.5.2, the reference code produced an error, something like:
Get http://127.0.0.1:2: EOF
this prevents being able to test error handling when a http request is unexpectedly disconnected from by the remote server.
go version: go1.6rc1 linux/amd64
os: ubuntu 14.04 x86_64
The text was updated successfully, but these errors were encountered:
ianlancetaylor
changed the title
httptest.Server.CloseClientConnections does not force a connection error in go1.6rc2
net/http/httptest: Server.CloseClientConnections does not force a connection error in go1.6rc2
Feb 10, 2016
Interesting... we have no test coverage for CloseClientConnections at all. And because CloseClientConnections just uses an internal closeConn function, and closeConn was made async for an earlier change, it ended up making CloseClientConnections async, which we then never noticed for lack of tests.
I filed #14291 to investigate making closeConn not async for Go 1.7, but for Go 1.6 we can probably just fix CloseClientConnections to wait on the conns being closed before returning, which would prevent your handler from then replying with 200 OK. (I can reproduce)
reference code: http://play.golang.org/p/MLJM0N3_SH
in go1.6rc2, the reference code returns a nil error and a valid response object with a 200 status code.
in go1.5.2, the reference code produced an error, something like:
Get http://127.0.0.1:2: EOF
this prevents being able to test error handling when a http request is unexpectedly disconnected from by the remote server.
The text was updated successfully, but these errors were encountered: