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

xhr

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xhr - npm Package Compare versions

Comparing version 0.3.3 to 0.3.4

31

index.js

@@ -5,2 +5,4 @@ /*global window*/

, protocolLess = /^\/\/[^\/]+\//
, hasProtocol = /^https?:\/\//
, messages = {

@@ -11,6 +13,7 @@ "0": "Internal XMLHttpRequest Error"

}
, Base = window.XDomainRequest ?
window.XDomainRequest :
window.XMLHttpRequest
, XHR = window.XMLHttpRequest
, XDR = "withCredentials" in (new XHR()) ?
window.XMLHttpRequest : window.XDomainRequest
createXHR.defaults = {}

@@ -24,4 +27,20 @@

var xhr = new Base()
, load = options.status === false ? call(xhr, callback) :
var xhr
, uri = options.uri
if ("cors" in options) {
if (options.cors) {
xhr = new XDR()
} else {
xhr = new XHR()
}
} else {
if (protocolLess.test(uri) || hasProtocol.test(uri)) {
xhr = new XDR()
} else {
xhr = new XHR()
}
}
var load = options.status === false ? call(xhr, callback) :
callWithStatus(xhr, callback)

@@ -38,3 +57,3 @@

xhr.timeout = "timeout" in options ? options.timeout : 5000
xhr.open(options.method, options.uri)
xhr.open(options.method, uri)

@@ -41,0 +60,0 @@ if (options.headers && xhr.setRequestHeader) {

2

package.json
{
"name": "xhr",
"version": "0.3.3",
"version": "0.3.4",
"description": "small xhr abstraction",

@@ -5,0 +5,0 @@ "keywords": [],

@@ -38,2 +38,9 @@ # xhr

### `options.cors`
Specify whether this is a cross domain request. Used in IE<10
to use `XDomainRequest` instead of `XMLHttpRequest`. If not
specified the library will pick `XDomainRequest` if the uri
has a protocol.
### `options.data`

@@ -40,0 +47,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