Closed jportway closed 3 years ago
Ah, this is because stubbing web socket streams is not supported. See: https://github.com/softwaremill/sttp/blob/8dcc4878b9f400fb45c10d80e5878f5a3d605830/core/src/main/scala/sttp/client3/testing/SttpBackendStub.scala#L239 - in this case, the response is not adapted corresponding to the response specification. I think it would require more knowledge of the streams than is currently captured by sttp.capabilities.Streams
, and the ability to "run" the stream.
thanks for looking into this - sorry for delay in closing the issue
Sending a request with a responseType :
asWebSocketStreamAlways(ZioStreams)(websocketHandler)
works fine with a normal "live" backend (AsyncHttpClientZioBackend or HttpClientZioBackend), but when I attempt to use a stubbed backend the "send" function returns immediately, with a "WebsocketStub" in the response, rather than actually opening a websocket.example code here : https://scastie.scala-lang.org/jportway/xB6GpNXfTeKsUvTQCnc11g/16
When using a "live" backend the code seems to work fine, however when I stub the backend like this :
the "send" function terminates immediately, returning :
Success(Response(sttp.ws.testing.WebSocketStub@7c00b63d,200,OK,List(),List(),RequestMetadata(GET,http://example.com,List())))