Logs outgoing http requests and responses.
npm install log-that-httpLogs _outgoing_ http requests and responses from Node.js.
- Writes each outgoing request and response to console.log
- request and response headers can be included
- request body can be included
- Zero dependencies
- Wide support for popular request libraries
- Node.js supported from version 8 upwards
``
npm install log-that-http axios node-fetch
node --require log-that-http -e "const axios=require('axios').default; axios.get('http://www.google.com');"
LOG_THAT_HTTP_HEADERS=true node --require log-that-http -e "const fetch=require('node-fetch').default; fetch('http://www.github.com');"
`
node --require log-that-http foo.js or use require('log-that-http') from within your script.
Use the following environment variables to add more info:
- LOG_THAT_HTTP_HEADERS=true to log all request and response headers.LOG_THAT_HTTP_BODY=true
- to log request bodies.
log-that-http is compatible with the popular request libraries and the built-in http and https-modules.
- axios
- got
- node-fetch
- request
- superagent
- http.get() and http.request()
- https.get() and https.request()
Compatibility with Node.js versions from 8 to 11 is tested with the help of npx` & node.
Missing something? Please file an issue.