http-inspector v0.1.11
http-inspector
What is it?
Did you ever want to see an HTTP requests log similar to the one in Chrome DevTools — but for Node.js?
http-inspector is a DevTools/Network for Node.js. It offers a simple CLI interface and a rich web UI.
http-inspector allows to view detailed information about all outgoing HTTP(S) requests a Node.js process makes. It is a library agnostic tool. It plays well with plain http (https) modules as well as with Axios, Superagent, Request, whatever else.
Usage
Adding to your project
First of all you should install http-inspector as development dependency in the project you want to inspect.
npm i -D http-inspectorThen you need to change your project's sources in order to require() the library on the top of your main script:
require('http-inspector/inject');It will patch the original Node.js http module so that all outgoing requests would be intercepted.
You can leave this line of code in producion, because http-inspector is disabled by default.
Also, if you don't want to change the source, and you run your script using node command, you can change:
node my-server.jsto:
HTTP_INSPECTOR=ui node -r 'http-inspector/inject' my-server.jsIn development mode, if you want to enable logging, your process should be run with HTTP_INSPECTOR environment variable set to one of the following values:
HTTP_INSPECTOR=pretty- output requests to consoleHTTP_INSPECTOR=curl- output requests as curl commandsHTTP_INSPECTOR=ui- send requests to http-inspector-ui at the default addresshttp://localhost:4380HTTP_INSPECTOR=ui:http://http-inspector-ui-host:1234- send requests to http-inspector-ui at the address specified
Using http-inspector-ui
Install and run http-inspector-ui:
npm i -g http-inspector-ui
http-inspector-uiEnable logging to http-inspector-ui by providing the following environment variable HTTP_INSPECTOR=ui.
Supported environments
Node.js - v8 and newer.
React Native- coming soon!
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago