interceptors icon indicating copy to clipboard operation
interceptors copied to clipboard

Low-level network interception library.

Results 104 interceptors issues
Sort by recently updated
recently updated
newest added

The standard `node:url` module ships with a `urlToHttpOptions` function that produces `ClientRequest` options from the given url. We can use that instead of the custom logic we have in normalizing...

chore

A proof of concept of using `async_hooks` for request interception. Quite interesting.

This PR aims to solve issue https://github.com/mswjs/msw/issues/778. I took the following approach : - Decorate the global AbortController class - Hold weak references to all controllers created - Once a...

Node.js behaviour: ```js const http = require('http'); const req = http.get('http://nowhere.com/', res => { console.log('response event'); }) req.on('finish', () => console.log('finish')) req.end('', null, () => console.log('callback')) ``` This prints: >...

https://github.com/mswjs/interceptors/blob/main/src/interceptors/ClientRequest/NodeClientRequest.ts#L101 `chunk` must not be undefined and throw: ``` TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received undefined ``` I...

I added a failing test. @kettanaito The current implementation of the `end` function is async ([unlike in Node](https://github.com/nodejs/node/blob/main/lib/_http_outgoing.js#L1073)), which forces us to set `this.finish = true` in the "sync" part...

Following of [this comment](https://github.com/mswjs/interceptors/pull/454#issuecomment-1741754945), I revisited the options parsing rules according to Node.js source and docs, and a few insights: 1. `host` and `hostname` are the same, hostname is preferred...

The `Response` merges the headers, so we don't get the original rawHeaders array. ![image](https://github.com/mswjs/interceptors/assets/11459632/f27e578f-37e2-4000-8e39-2dd93a82c824) @kettanaito WDYT? P.S: I fixed a small error in headers, set-cookie is not an array. (easy...

We don't suppress any error **after** the `MockLookupEnd` state. It seems like Node still emits some errors that we might want to suppress or avoid somehow. ```js const { ClientRequestInterceptor...