Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

axios-debug-log

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

axios-debug-log - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

compositor.json

9

index.js
'use strict'
var axios = require('axios')
var debug = require('debug')('axios')
var axiosDebug = require('debug')('axios')

@@ -28,3 +28,4 @@ var options = {

function addLogger (instance) {
function addLogger (instance, debug) {
if (debug === undefined) debug = axiosDebug
instance.interceptors.request.use(function (config) {

@@ -53,3 +54,3 @@ options.request(debug, config)

module.exports = function (userOptions) {
exports = module.exports = function (userOptions) {
for (var key in options) {

@@ -61,1 +62,3 @@ if (key in userOptions) {

}
exports.addLogger = addLogger
{
"name": "axios-debug-log",
"version": "0.3.0",
"version": "0.4.0",
"description": "Axios interceptor of logging requests & responses by debug.",

@@ -22,3 +22,3 @@ "main": "index.js",

"author": "George Chung <Gerhut@GMail.com>",
"license": "MIT",
"license": "BSD-3-Clause",
"bugs": {

@@ -29,16 +29,16 @@ "url": "https://github.com/Gerhut/axios-debug-log/issues"

"dependencies": {
"debug": "^2.6.0"
"debug": "^3.0.0"
},
"devDependencies": {
"axios": "^0.15.0",
"axios": ">=0.13.0",
"mocha": "^3.2.0",
"nyc": "^10.1.2",
"should": "^11.2.0",
"should-sinon": "0.0.5",
"sinon": "^1.17.7",
"standard": "^8.6.0"
"nyc": "^11.0.2",
"should": "^13.0.0",
"should-sinon": "0.0.6",
"sinon": "^4.0.0",
"standard": "^10.0.2"
},
"peerDependencies": {
"axios": "^0.15.0"
"axios": ">=0.13.0"
}
}
# axios-debug-log
[![Greenkeeper badge](https://badges.greenkeeper.io/Gerhut/axios-debug-log.svg)](https://greenkeeper.io/)
[![Build Status](https://travis-ci.org/Gerhut/axios-debug-log.svg?branch=master)](https://travis-ci.org/Gerhut/axios-debug-log)
[![Coverage Status](https://coveralls.io/repos/github/Gerhut/axios-debug-log/badge.svg?branch=master)](https://coveralls.io/github/Gerhut/axios-debug-log?branch=master)
[![dependencies Status](https://david-dm.org/Gerhut/kroxy/status.svg)](https://david-dm.org/Gerhut/axios-debug-log)
[![devDependencies Status](https://david-dm.org/Gerhut/kroxy/dev-status.svg)](https://david-dm.org/Gerhut/axios-debug-log?type=dev)
[![dependencies Status](https://david-dm.org/Gerhut/axios-debug-log/status.svg)](https://david-dm.org/Gerhut/axios-debug-log)
[![devDependencies Status](https://david-dm.org/Gerhut/axios-debug-log/dev-status.svg)](https://david-dm.org/Gerhut/axios-debug-log?type=dev)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)

@@ -50,4 +51,16 @@

## Customization
Use `require('axios-debug-log').addLogger(instance, debug)` to add custom debug
logger to custom instance.
```javascript
var github = axios.create({ baseURL: 'https://api.github.com/' })
var githubLogger = require('debug')('github')
require('axios-debug-log').addLogger(github, githubLogger)
github('/user')
```
## License
MIT

@@ -81,5 +81,27 @@ /* eslint-env mocha */

it('should add custom debug logger to axios instance', () => {
const spy = sinon.spy()
const instance = axios.create({})
require('.').addLogger(instance, spy)
return instance({
url: 'http://example.com/',
adapter: config => Promise.resolve({
status: 200,
statusText: 'OK',
config
})
}).then(() => {
spy.should.be.calledTwice()
spy.firstCall.should.be.calledWithExactly(
'GET http://example.com/'
)
spy.secondCall.should.be.calledWithExactly(
'200 OK', '(GET http://example.com/)'
)
})
})
it('should be able to set format of response & response logging', () => {
const requestLogger = sinon.spy((debug, config) => debug(config.method))
const responseLogger = sinon.spy((debug, response) => debug(response.statusText))
const requestLogger = sinon.spy((debug, config) => debug(config.method.toUpperCase()))
const responseLogger = sinon.spy((debug, response) => debug(response.statusText.toUpperCase()))
require('.')({

@@ -86,0 +108,0 @@ request: requestLogger,

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc