New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

axiosist

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

axiosist - npm Package Compare versions

Comparing version 0.8.0 to 0.9.0

21

index.js

@@ -25,2 +25,11 @@ /**

/**
* @param {string} urlString the url to tell.
* @returns {boolean} whether the url is absolute url.
*/
const isAbsoluteUrl = (urlString) => {
const url = new URL(urlString, 'http://axiosist/')
return url.host !== 'axiosist'
}
/**
* @param {Handler} handler A handler for axiosist, may be a request listener or a http server.

@@ -30,3 +39,4 @@ * @returns {AxiosAdapter} The axios adapter would used in adapter options of axios.

const createAdapter = handler => config => new Promise((resolve, reject) => {
const url = new URL(config.url || '', 'http://axiosist/')
const urlField = isAbsoluteUrl(config.url || '') ? 'url' : 'baseURL'
const url = new URL(config[urlField] || '', 'http://axiosist/')

@@ -36,7 +46,5 @@ // Forcely set protocol to HTTP

const host = url.host
url.host = '127.0.0.1'
// Apply original host to request header
if (host !== 'axiosist' && config.headers.host == null) {
config.headers.host = host
if (url.host !== 'axiosist' && config.headers.host == null) {
config.headers.host = url.host
}

@@ -55,4 +63,5 @@

const address = /** @type {AddressInfo} */(server.address())
url.host = '127.0.0.1'
url.port = address.port.toString()
config.url = url.toString()
config[urlField] = url.toString()
return defaultAdapter(config)

@@ -59,0 +68,0 @@ })

{
"name": "axiosist",
"version": "0.8.0",
"version": "0.9.0",
"description": "Convert node.js request handler to axios adapter",

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

"@types/node": ">=10.13.0",
"axios": "0.19.0"
"axios": "^0.19.1"
},

@@ -40,0 +40,0 @@ "devDependencies": {

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