Chunked Encoding Response Check (Chunk Response Handler)


Running into a use case that I’m having a hard time finding info for. I’m currently interacting with a system that returns a chunked transfer response when a GET is performed:

  • Connected to localhost (::1) port 8080 (#0)

Host: localhost:8080
User-Agent: curl/7.43.0
Accept: /

HTTP/1.1 200 OK
Content-Type: application/json
Content-Disposition: attachment; filename=json.json
Pragma: no-cache
Cache-Control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0
Transfer-Encoding: chunked

Each chunk then contains a message that is being streamed. Gatling doesn’t currently seem to run checks until a response is fully received, which never happens since the connection is kept open for streaming. Is there something that I can do so that I can check the body as a chunk arrives?


this is with the latest stable, 2.2.2

Well, we do support Server Sent Events, which looks VERY similar to what you’re doing.

Oh wow thanks, I didn’t realize that was the purpose. Let me try using that and get back to you on the result. Thanks again!

Beware that SSE chunks must comply with the spec.
If you’ve implemented your own custom protocol, you’ll be stuck. But then, the question would be: why not stick to a standard such as SSE or WebSocket?

It is a custom protocol, but it seems to be very close to the sse spec, I was able to parse messages with that. Json was broken due to not being in spec, but the raw regex worked great. Thanks for the help.