-
Notifications
You must be signed in to change notification settings - Fork 310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE] Stub for testing websocket stream #1493
Comments
Did you try wrapping the stubbed web socket stream with |
I've tried it just now with the following backend: val testingBackend: SttpBackend[IO, Fs2Streams[IO] with WebSockets] = AsyncHttpClientFs2Backend
.stub[IO]
.whenAnyRequest
.thenRespond(
SttpBackendStub.RawStream(
WebSocketStub
.initialReceive(List(WebSocketFrame.text("Hello, World!")))
.thenRespond(_ => List(WebSocketFrame.text("Hello, World!")))
)
) However it does not seem to be working (unless I've done something wrong). |
Right, there's However, I don't think we can make this work, as it would require fusing the client-side pipe specified in the |
I'll close this as won't fix as we can't really do much with a stream pipe - it's opaque for sttp. If you would have some ideas how to fix this, please reopen :) |
I want to propose a solution to this one. I solved it by writing my own sttp backend stub.
It's mvp-ish implementation to satisfy my needs but with a few changes to
then it would be enough to extend the stub for particular types and override |
@Zuchos yeah you're right, we could add |
Additional note for sttp3, today I've spent quite some time debugging why my streams are not consumed. In the end I found the magical Do you think we could raise an error instead of failing silently in this case? |
@Krever yeah you're right, throwing errors might be better than returning |
Original question/feature request was posted in gitter: https://gitter.im/softwaremill/sttp?at=605d9dbd563232374c459a79
Consider I have a function which sends a request via
asWebSocketStream
:where backend is
SttpBackend[F, Fs2Streams[F] with capabilities.WebSockets]
.Given that web socket streams aren't supported by the stub, it is impossible to test such function.
A possible solution would be to provide a stub for testing web socket streams.
The text was updated successfully, but these errors were encountered: