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.6.2 to 0.7.0

9

index.d.ts
import { AxiosInstance, AxiosRequestConfig, AxiosResponse, AxiosError } from "axios";
import { Debugger } from "debug";
interface UserOptions {
declare interface UserOptions {
request(debug: Debugger, config: AxiosRequestConfig): void;

@@ -10,3 +10,6 @@ response(debug: Debugger, response: AxiosResponse): void;

export default function(userOptions: UserOptions): void;
export function addLogger(instance: AxiosInstance, debug: Debugger): void;
declare const config: ((userOptions: UserOptions) => void) & {
addLogger(instance: AxiosInstance, debug: Debugger): void;
}
export = config;
'use strict'
var axios = require('axios')
var isAbsoluteURL = require('axios/lib/helpers/isAbsoluteURL')
var buildURL = require('axios/lib/helpers/buildURL')
var combineURLs = require('axios/lib/helpers/combineURLs')
var axiosDebug = require('debug')('axios')
const getURL = (config) => {
return buildURL(config.url, config.params, config.paramsSerializer)
var URL_KEY = '__AXIOS-DEBUG-LOG_URL__'
function getURL (config) {
var url = config.url
if (config.baseURL && !isAbsoluteURL(url)) {
url = combineURLs(config.baseURL, url)
}
return buildURL(url, config.params, config.paramsSerializer)
}

@@ -13,10 +21,13 @@

request: function (debug, config) {
var url = getURL(config)
Object.defineProperty(config, URL_KEY, { value: url })
debug(
config.method.toUpperCase() + ' ' + getURL(config)
config.method.toUpperCase() + ' ' + url
)
},
response: function (debug, response) {
var url = response.config[URL_KEY]
debug(
response.status + ' ' + response.statusText,
'(' + response.config.method.toUpperCase() + ' ' + getURL(response.config) + ')'
'(' + response.config.method.toUpperCase() + ' ' + url + ')'
)

@@ -26,5 +37,6 @@ },

if (error.config) {
var url = error.config[URL_KEY]
debug(
error.name + ': ' + error.message,
'(' + error.config.method.toUpperCase() + ' ' + getURL(error.config) + ')'
'(' + error.config.method.toUpperCase() + ' ' + url + ')'
)

@@ -31,0 +43,0 @@ } else {

{
"name": "axios-debug-log",
"version": "0.6.2",
"version": "0.7.0",
"description": "Axios interceptor of logging requests & responses by debug.",
"main": "index.js",
"files": [
"index.js",
"index.d.ts"
],
"scripts": {
"lint": "standard",
"typing": "tsc",
"test": "mocha --require should --require should-sinon",
"coverage": "nyc npm test && nyc report --reporter=html"
"test": "mocha",
"coverage": "nyc mocha",
"postcoverage": "nyc report --reporter=html"
},

@@ -32,14 +37,14 @@ "repository": {

"devDependencies": {
"axios": ">=0.13.0",
"mocha": "^6.1.4",
"nyc": "^14.0.0",
"axios": ">=0.17.0",
"mocha": "^7.0.1",
"nyc": "^15.0.0",
"should": "^13.1.3",
"should-sinon": "0.0.6",
"sinon": "^7.1.1",
"standard": "^12.0.0",
"sinon": "^9.0.0",
"standard": "^14.0.0",
"typescript": "^3.5.1"
},
"peerDependencies": {
"axios": ">=0.13.0"
"axios": ">=0.17.0"
}
}
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