-
-
Notifications
You must be signed in to change notification settings - Fork 745
Closed
mswjs/interceptors
#724Labels
Description
Please avoid duplicates
- I checked all open bugs and none of them matched my problem.
Reproducible test case
https://github.com/trentm/repro-nock-14-gzip-bug
Nock Version
nock@14.0.0
Node Version
v20.18.1
TypeScript Version
No response
What happened?
I am using nock.back
to record and replay HTTP responses for testing. A basic test works for me with fetch()
requests.
When I added server-side gzip compression the replayed responses are missing the headers
.
The recording looks like this:
[
{
"scope": "http://127.0.0.1:3001",
"method": "GET",
"path": "/",
"body": "",
"status": 200,
"response": [
"1f8b0800000000000013ab562ac8cc4b57b2522ac8cf4b57aa0500a67de8f20f000000"
],
"rawHeaders": {
"connection": "keep-alive",
"content-encoding": "gzip",
"content-type": "application/json",
"date": "Wed, 29 Jan 2025 01:11:24 GMT",
"keep-alive": "timeout=5",
"transfer-encoding": "chunked"
},
"responseIsBinary": false
}
]
But the Response
object when using that recording looks like this:
res: Response {
status: 200,
statusText: '',
headers: Headers {},
body: ReadableStream { locked: false, state: 'readable', supportsBYOB: false },
bodyUsed: false,
ok: true,
redirected: false,
type: 'default',
url: 'http://127.0.0.1:3001/'
}
I walk through a working example and the failing case (with code) at: https://github.com/trentm/repro-nock-14-gzip-bug#readme
(I'll click "yes" to contributing below, however, I'm not sure of my available time for digging in. Pointers would be appreciated.)
Would you be interested in contributing a fix?
- yes