Open denisftw opened 6 days ago
If the server responds with a 400, I guess it's a server problem, not a client one?
Hi @adamw ! Thanks for a quick response!
I would think so, but even then, there are still two unsolved mysteries:
I investigated a bit more and noticed one thing that could probably explain why it doesn't work.
When I'm using Java 11's HttpClient as the backend, it adds tons of HTTP2-related headers:
However, when I switch to AsyncHttpClient, there are only a few headers and nothing about HTTP2:
In both cases I use the same code to form the request (shown above). Since AsyncHttpClient backend works and Java 11 doesn't, I assume that the problem is the headers or maybe inability of ZIO HTTP Server to work with it.
I also updated the sample repo, added an example with ZIO HTTP as a client (which also works and sends headers similar to AsyncHttpClient backend).
Maybe you can try writing a test using Java's HttpClient directly? If this shows incorrect behavior, then I think that would be a good bug report for ZIO HTTP (as it would demonstrate a failing test case).
So, I'm trying to handle a pretty simple scenario. The client sends several strings
separated by
\n
and encoded into bytes as a stream. The server is supposed to read them all and send back the count in the200 OK
response. However, it doesn't work.Whenever I try to send a POST request like this
the response is returned before (!) it's completed on the server-side. The response is a 400 with empty body and a warning header that reads:
However, on the server, I can easily put a breakpoint and check all the elements of the original stream.
I created a repo with a minimal example: https://github.com/denisftw/sttp-zio-streaming-response It contains two
main
applications:HttpClientMain
, which is a client that usessttp
, andHttpServerApplication
, which is a server that uses ZIO HTTP.Am I missing something here?