Attempting to use WSD with an endpoint that returns an HTTP 400 Bad Request results in a segfault. It probably ought to detect non-OK responses and report them appropriately.
$ curl -s --include "http://localhost:9080/ws-bi-stream?products=elephant"
HTTP/1.1 400 Bad Request
Server: myapp
Date: Fri, 09 Jun 2017 01:55:05 GMT
Content-Type: text/plain; charset=UTF-8
Content-Length: 51
Invalid request:
'elephant' is not a valid product
$ ./wsd.exe -url "ws://localhost:9080/ws-bi-stream?products=elephant"
connecting to ws://localhost:9080/ws-bi-stream?products=elephant from http://localhost/...
panic: websocket.Dial ws://localhost:9080/ws-bi-stream?products=elephant: bad status
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x68 pc=0x5e122d]
goroutine 1 [running]:
golang.org/x/net/websocket.(*Conn).Close(0x0, 0x2, 0x2)
.../go/src/golang.org/x/net/websocket/websocket.go:236 +0x2d
panic(0x61a940, 0xc0420da340)
C:/Go/src/runtime/panic.go:489 +0x2dd
main.main()
.../wsd/main.go:126 +0xbaa
Attempting to use WSD with an endpoint that returns an
HTTP 400 Bad Requestresults in a segfault. It probably ought to detect non-OK responses and report them appropriately.