![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
@apihero/interceptors-js
Advanced tools
Low-level HTTP/HTTPS/fetch request interception library for Node.js and [Fetch platforms](https://fetch.spec.whatwg.org)
Low-level HTTP/HTTPS/fetch request interception library for Node.js and Fetch platforms
This library was inspired by @mswjs/interceptors, but is not for mocking. Instead, this library allows requests to be intercepted and altered before they are sent, in a way that does not require an extra request fetching library.
npm install @apihero/interceptors-js
import { FetchInterceptor } from "@apihero/interceptors-js/lib/interceptors/fetch";
const interceptor = new FetchInterceptor();
interceptor.apply();
interceptor.on("request", (request) => {
console.log(`request ${request.method}: ${request.url.href}`);
});
Use request.requestWith()
to modify a request before it is executed.
import { FetchInterceptor } from "@apihero/interceptors-js/lib/interceptors/fetch";
const interceptor = new FetchInterceptor();
interceptor.apply();
interceptor.on("request", (request) => {
// Use a different url for the request, and override a header
request.requestWith({
url: new URL(request.url.pathname, "https://proxy.url"),
headers: {
"x-override": "this is a new header",
},
});
});
If you want to modify the host of a ClientRequest, make sure to also listen to the connect
event and respond with the request.connectWith
callback:
import { ClientRequestInterceptor } from "@apihero/interceptors-js/lib/interceptors/ClientRequest";
const interceptor = new ClientRequestInterceptor();
interceptor.apply();
interceptor.on("connect", (request) => {
// Connect to a different host
request.connectWith({
url: new URL(request.url.pathname, "https://proxy.url"),
});
});
interceptor.on("request", (request) => {
// Also override a header
request.requestWith({
headers: {
"x-override": "this is a new header",
},
});
});
FAQs
Low-level HTTP/HTTPS/fetch request interception library for Node.js and [Fetch platforms](https://fetch.spec.whatwg.org)
We found that @apihero/interceptors-js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.