项目作者: sebastianlzy

项目描述 :
A simple debugging log for superagent
高级语言: JavaScript
项目地址: git://github.com/sebastianlzy/superagent-debugger.git
创建时间: 2017-01-22T13:46:34Z
项目社区:https://github.com/sebastianlzy/superagent-debugger

开源协议:

下载


Simple Log For Super Agent

Build Status
Coverage Status

Introduction

An easy and fast way to identify and replicate rogue request on the fly

Dependencies

Logging and debugging for superagent


Install

  1. npm install --save superagent-debugger

Usage

  1. let superagent = require('superagent');
  2. let superdebug = require('superagent-debugger');
  3. superagent('GET', 'http://localhost:3000/debug')
  4. .set({Accept: 'application/json'})
  5. .query({superdebug: 'is-awesome'})
  6. .use(superdebug(console.info))
  7. .timeout(10000)
  8. .send()
  9. .end()

Output Log

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

Using Debug

  1. DEBUG=super-debug,super-curl node sdk.js

screeshot1

options

  1. const options = {logName: 'logDebug', curlName: 'curlDebug'}
  2. superagent('GET', 'http://localhost:3000/debug')
  3. .set({Accept: 'application/json'})
  4. .query({superdebug: 'is-awesome'})
  5. .use(superdebug(console.info, options))
  1. DEBUG=logDebug,curlDebug node sdk.js

Help

Refer to the example provided

Improvement

  1. Test/Test coverage report
  2. CI/CD process
  3. Allow debug for client side request

Any feedbacks or contributions are welcome!