-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Closed
Labels
Description
What did you do?
Use a http.RoundTripper that returns neither response nor error.
https://play.golang.org/p/EGEjS2P2xQI
What did you expect to see?
Documentation that the RoundTripper MUST return either response or error.
What did you see instead?
Lines 119 to 125 in 1dc0110
// RoundTrip should not attempt to interpret the response. In | |
// particular, RoundTrip must return err == nil if it obtained | |
// a response, regardless of the response's HTTP status code. | |
// A non-nil err should be reserved for failure to obtain a | |
// response. Similarly, RoundTrip should not attempt to | |
// handle higher-level protocol details such as redirects, | |
// authentication, or cookies. |
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0xffffffff addr=0x0 pc=0x24bc42]
goroutine 1 [running]:
net/http.redirectBehavior(0x311a6b, 0x3, 0x0, 0x84c510, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/net/http/client.go:422 +0x22
net/http.(*Client).do(0x840940, 0x84c510, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/net/http/client.go:655 +0x3a0
net/http.(*Client).Do(...)
/usr/local/go/src/net/http/client.go:509
net/http.(*Client).Get(0x840940, 0x3122b2, 0x7, 0x5503, 0x0, 0x0, 0x0, 0x5503)
/usr/local/go/src/net/http/client.go:398 +0xa0
main.main()
/tmp/sandbox656600978/prog.go:15 +0xc0
Program exited: status 2.