v1.18.1
This patch fixes gzip responses for requests that set their own Accept-Encoding header, and makes secret masking a bit faster.
Gzip with your own Accept-Encoding
Resterm only decoded gzip when it added Accept-Encoding itself. If the request set that header, the body stayed compressed, so @assert, captures, scripts and the response pane all got gzip bytes. Requests imported with curl --compressed set the header too.
### Users
# @name users
# @assert response.json()[0].name == "david"
GET http://localhost:3000/users
Accept-Encoding: gzipBefore 1.18.1, the check failed:
FAIL GET users [users.http:3:24: invalid json]
Script Error:
error[script]: invalid json
--> users.http:3:24
|
3 | # @assert response.json()[0].name == "david"
| ^
Now it passes:
PASS GET users [200 OK in 728.875µs]
- A gzip response is decoded whether Resterm or the request asked for it. The decoded response has no
Content-EncodingorContent-Lengthheader, the same as when Resterm asks for gzip itself. - Gzip that can't be decoded used to pass with the broken body. Now the request fails with exit 26:
FAIL GET bad [read response body: invalid gzip header: gzip: invalid header]
- SSE streams are decoded as they arrive, so events,
byteCountandmax-bytesuse the decoded data, not the compressed bytes. An event stream in an encoding Resterm can't decode, such asbr, now fails with exit 26 instead of passing. br,deflateand206 Partial Contentbodies stay as they arrived.curl --compressedimports now writeAccept-Encoding: gzipinstead ofgzip, deflate, br, since Resterm can't decode the other two.- With
--response,bodySizeis the decoded size.
See HTTP settings and streaming.
Faster masking
Masking secrets in JSON is faster. A 1 MiB JSON body now takes about 6 ms instead of 11 ms. This covers --response bodies, history, stream transcripts and trace files.
Upgrading
- Decoded gzip responses have no
Content-EncodingorContent-Lengthheader. Update checks that read them. - Gzip that can't be decoded fails the request with exit 26. So does an event stream in another encoding, such as
br. - Requests imported with
curl --compressedbefore 1.18.1 still ask forgzip, deflate, br. Abrordeflatebody is kept as it arrived, so change the header togzip.
If you're upgrading from 1.17.2 or older, read the 1.18.0 notes.