JSPM

superdebug

2.2.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 238
  • Score
    100M100P100Q86422F
  • License MIT

Debug Superagent Requests - generates curl output

Package Exports

  • superdebug

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (superdebug) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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 and formData

Install

npm i -S superdebug

Usage

let superagent = require('superagent');
let superdebug = require('superdebug');

superagent('GET', 'http://localhost:3000/debug')
    .set({Accept: 'application/json'})
    .query({superdebug: 'is-awesome'})
    .use(superdebug(console.info))
    .timeout(10000)
    .send()
    .end()

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 +0ms
super-debug HTTP GET 200 http://localhost:3000/debug?superdebug=is-awesome (23ms) +25ms

Using Debug

DEBUG=super-* node test/test-server.js

superdebug-1

output with json data

superdebug-2

Options

  • you can call superdebug() without arguments -> produces only log output with set DEBUG environment variable:
    • examples: DEBUG=super-curl or DEBUG=super-debug
  • or you can call superdebug(console.info) with your preferred logger e.g. console.info
superagent('GET', 'http://localhost:3000/debug')
  .use(superdebug())

Test

run:

npm test

License

MIT

Credits