Debug Superagent Requests - generates curl output
- logging for superagent
- logs in curl format
- let's you copy&paste the curl output to send to someone else
- works with node.js and in the browser with browserify or webpack
- only dependency is debug
- works with sent
data
andformData
Install
npm i -S superdebug
Usage
let superagent = ;let superdebug = ;
Output Log
super-curl curl -v -X GET -H 'User-Agent: node-superagent/3.3.2' -H 'Accept: application/json' http://localhost:3000/debug?superdebug=is-awesome +0mssuper-debug HTTP GET 200 http://localhost:3000/debug?superdebug=is-awesome (23ms) +25ms
Using Debug
DEBUG=super-* node test/test-server.js
output with json data
Options
- you can call
superdebug()
without arguments -> produces only log output with setDEBUG
environment variable:- examples:
DEBUG=super-curl
orDEBUG=super-debug
- examples:
- or you can call
superdebug(console.info)
with your preferred logger e.g.console.info
Test
run:
npm test
License
MIT