
Product
Socket for Jira Is Now Available
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.
node-http-interceptor
Advanced tools
⚡ Intercept the low-level http requests, which is helpful when you need to do logging, monitoring or instrumentation etc.
ClientRequest or IncomingMessage) when downstream consumer is not going to read or writeRequestContext is a request scope container to hold any data during the request-response round-trip, which is like the concept of HttpServletRequest.getAttributes() in Java.RequestContext
npm i -g node-http-interceptor
ln -vs "$(npm root -g)" "$HOME"/.node_modules
node -r node-http-interceptor/register
import { HttpInterceptor, RequestContext } from './http-interceptor';
const interceptor = new HttpInterceptor();
interceptor.on('request.initiated', (request: ClientRequest, context: RequestContext) => {
// do somethong to mutate request
})
interceptor.on('request.sent', (request: Request, context: RequestContext) => {
// log the request
})
interceptor.on('response.received', (request: Request, response: Response, context: RequestContext) => {
// log the response
})
interceptor.on('response.error', (request: Request, error: any, context: RequestContext) => {
// log the error
})
interceptor.on('socket.error', (request: Request, error: any, context: RequestContext) => {
// log the error
})
interceptor.enable()
const interceptor = new HttpInterceptor();
interceptor.stub((req: Request) => ({
statusCode: 200,
statusMessage: 'OK',
headers: {
'content-type': 'text/plain',
'x-custom-header': 'blabla'
},
body: Buffer.from('test')
}));
interceptor.on('response.received', (response: Response, context: RequestContext) => {
expect(response.body.toString()).toEqual('test')
})
interceptor.enabled();
// later on
interceptor.unstub()
FAQs
node-http-interceptor
We found that node-http-interceptor demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.