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

@chunpu/http

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@chunpu/http - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

test/testaxios.js

5

package.json
{
"name": "@chunpu/http",
"version": "2.0.0",
"version": "2.1.0",
"description": "Promise Based request / fetch / http For Real Project, Support multiple platforms",
"main": "index.js",
"scripts": {
"test": "node test",
"test": "node test && node test/testaxios",
"build": "webpack"

@@ -37,2 +37,3 @@ },

"devDependencies": {
"axios": "^0.18.0",
"body-parser": "^1.18.3",

@@ -39,0 +40,0 @@ "express": "^4.16.3",

12

src/adapters/jquery.js

@@ -8,3 +8,3 @@ const utils = require('../utils')

return new Promise((resolve, reject) => {
defaults.jQuery.ajax({
var xhr = defaults.jQuery.ajax({
url: config.url,

@@ -30,4 +30,14 @@ data: config.data,

})
if (config.cancelToken) {
config.cancelToken.promise.then(function onCancel(reason) {
if (xhr) {
xhr.abort()
reject(reason)
xhr = null
}
})
}
})
}
}

@@ -33,4 +33,11 @@ const utils = require('../utils')

}
if (config.cancelToken) {
// not real cancel, wait for api
config.cancelToken.promise.then(function onCancel(reason) {
reject(reason)
})
}
})
}
}

@@ -34,7 +34,18 @@ const utils = require('../utils')

}
task = null
reject(utils.createError('timeout'))
}, config.timeout)
}
if (config.cancelToken) {
config.cancelToken.promise.then(function onCancel(reason) {
if (task && task.abort) {
task.abort()
reject(reason)
task = null
}
})
}
})
}
}
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