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 1.11.0 to 1.12.0

4

index.js

@@ -59,5 +59,7 @@ var window = require("global/window")

xhr.open(method, uri, !sync)
if (options.cors) {
if (options.cors && options.withCredentials !== false) {
xhr.withCredentials = true
}
// Cannot set timeout with sync request

@@ -64,0 +66,0 @@ if (!sync) {

{
"name": "xhr",
"version": "1.11.0",
"version": "1.12.0",
"description": "small xhr abstraction",

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

@@ -36,3 +36,4 @@ # xhr

body: String?,
json: Object?
json: Object?,
withCredentials: Boolean?
}

@@ -104,2 +105,9 @@ xhr := (XhrOptions, Callback<Response>) => Request

### `options.withCredentials`
Specify whether user credentials are to be included in a cross-origin
request. Sets [`xhr.withCredentials`][10]. Defaults to true
when `options.cors` is true.
## MIT Licenced

@@ -116,1 +124,2 @@

[9]: http://xhr.spec.whatwg.org/#the-setrequestheader()-method
[10]: http://xhr.spec.whatwg.org/#the-withcredentials-attribute

@@ -23,1 +23,24 @@ var window = require("global/window")

test("withCredentials option", function(assert) {
var req = xhr({}, function () {})
assert.ok(
!req.withCredentials,
"withCredentials not true when nothing set in options"
)
req = xhr({
cors: true
}, function () {})
assert.ok(
req.withCredentials,
"withCredentials set to true when cors is true in options"
)
req = xhr({
cors: true,
withCredentials: false
}, function () {})
assert.ok(
!req.withCredentials,
"withCredentials set to false when set to false in options"
)
assert.end()
})
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