Simple node app to log http request right into your console.
Run the following to install httplog globally on your system.
npm install -g @floriandorau/httplog
After that run httplog --help
to see how it works.
Use the following command to start a local http server running at port 8080.
httplog --port 8080
You can now redirect your traffic to the started http server. Your request data will dumped into your console.
Usage: httplog [options]
Simple tool to log http requests into your terminal
Options:
-V, --version output the version number
-p, --port <port> Port where to listen for incoming requests
-f, --file <file> Pipe http request to <file>
-r, --response <file> Provide a mock response from <file>
-b, --browser Pipe http requests to your preferred browser
-n, --ngrok Exposes httplog to the public internet using ngrok
-d, --debug Enable debug logging
--proxy-mode <host:port> [BETA] Runs httplog in a proxy mode where incoming request will be forwared to "host:port"
-h, --help display help for command
Use this option to log incoming requests into a file, e.g.
httplog --port 8080 --file requests.txt
Use this option to make your httplog server available over the public internet, e.g.
httplog --port 8080 --ngrok
With the above command the port 8080
will be exposed using the ngrok service.
Use this option to log incoming requests in your browser, e.g.
httplog --port 8080 --browser
Use this option to mock response status and data, e.g.
httplog --port 8080 --response ./response.json
The response.json
file should look like the following
{
"status": 200,
"type": "json",
"data": {
"Foo": "Bar"
}
}
The response file will be read with every incoming request which means that you can modify the file content to change response behavior without restarting httplog
process.
Currently json
and text
are supported response types. If no type
is present text
will be used as default.
Use this option to make httplog acting as a proxy, e.g.
httplog --port 8080 --proxy-mode localhost:8081
With this each incoming request at port 8080
will be forwarded to port 8081
too.