Mercurial > prosody-hg
comparison spec/net_http_parser_spec.lua @ 14086:79a6598cef0b 13.0
net.http.parser: Fix handling of chunked request
How to determine whether a request/response has a body depends on
different things for requests and responses, which was not reflected in
the code.
Test case based on
curl http://localhost:5280/debug -H "Transfer-Encoding: chunked" --json '{"json":true}'
Thanks isafashiondev
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Fri, 20 Feb 2026 15:08:03 +0100 |
| parents | db30ffbf2090 |
| children |
comparison
equal
deleted
inserted
replaced
| 14073:dfbc60d47668 | 14086:79a6598cef0b |
|---|---|
| 118 ]], | 118 ]], |
| 119 { | 119 { |
| 120 body = "Hello", count = 3; | 120 body = "Hello", count = 3; |
| 121 } | 121 } |
| 122 ); | 122 ); |
| 123 | |
| 124 test_stream( | |
| 125 "POST /debug HTTP/1.1\r\nHost: localhost:5280\r\nUser-Agent: curl/8.14.1\r\nTransfer-Encoding: chunked\r\nContent-Type: application/json\r\n" | |
| 126 .."Accept: application/json\r\n\r\nd\r\n{\"json\":true}\r\n0\r\n\r\n", | |
| 127 { count = 2; body = "{\"json\":true}" }) | |
| 123 end); | 128 end); |
| 124 | 129 |
| 125 it("should handle a stream of responses", function () | 130 it("should handle a stream of responses", function () |
| 126 test_stream( | 131 test_stream( |
| 127 | 132 |
