Tim Harper

Results 107 comments of Tim Harper

Ok! figured it out. Simple `get` is unaffected, it only happens with `POST` requests with payloads. Recording works just fine, but on playback: ``` ➜ nockback-axios-recording git:(main) ✗ yarn jest...

If I downgrade nock to 13.x, sure enough, the error goes away

It succeeds with nock `v13.5.6`, but fails with `v14.0.0-beta.1`. There's only two commits betwixt here. One is purely a CI change, the other: 8b8c0c27e26db1aebc943bd65a97f2eb212cc5c7 So the regression must be there

Maybe `"@mswjs/interceptors": "^0.37.3"` is where the bug actually lies.

Here's where the abort is actually received: https://github.com/axios/axios/blob/08b84b52d5835d0c7b81049c365c3d271ade8bff/lib/adapters/http.js#L761 ``` FAIL src/lib/EchoApi/AxiosEchoApiClient.test.ts ● AxiosEchoApiClient › should post form data and return echo response AxiosError: stream has been aborted 18 | }...

figured it out. it's the content-length header combined with JSON. With nock back recorded fixtures for JSON, the JSON gets parsed and stored as a JSON object, then re-serialized. Which...

Workaround: ```typescript type DefinitionWithRawHeaders = nock.Definition & { rawHeaders?: Record; }; const back = await nock.back(fixtureFileName, { before: (def: DefinitionWithRawHeaders) => { if (def.rawHeaders) { delete def.rawHeaders['content-length']; } }, });...