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

metal-ajax

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metal-ajax - npm Package Compare versions

Comparing version 1.0.0-rc.1 to 1.0.0-rc.2

7

lib/Ajax.js

@@ -68,2 +68,3 @@ 'use strict';

* @param {boolean=} opt_sync
* @param {boolean=} opt_withCredentials
* @return {Promise} Deferred ajax request.

@@ -75,3 +76,3 @@ * @protected

key: 'request',
value: function request(url, method, body, opt_headers, opt_params, opt_timeout, opt_sync) {
value: function request(url, method, body, opt_headers, opt_params, opt_timeout, opt_sync, opt_withCredentials) {
var request = new XMLHttpRequest();

@@ -105,2 +106,6 @@

if (opt_withCredentials) {
request.withCredentials = true;
}
if (opt_headers) {

@@ -107,0 +112,0 @@ opt_headers.names().forEach(function (name) {

2

package.json
{
"name": "metal-ajax",
"version": "1.0.0-rc.1",
"version": "1.0.0-rc.2",
"description": "Metal.js utility to perform Ajax requests",

@@ -5,0 +5,0 @@ "license": "BSD",

@@ -47,6 +47,7 @@ 'use strict';

* @param {boolean=} opt_sync
* @param {boolean=} opt_withCredentials
* @return {Promise} Deferred ajax request.
* @protected
*/
static request(url, method, body, opt_headers, opt_params, opt_timeout, opt_sync) {
static request(url, method, body, opt_headers, opt_params, opt_timeout, opt_sync, opt_withCredentials) {
var request = new XMLHttpRequest();

@@ -80,2 +81,6 @@

if (opt_withCredentials) {
request.withCredentials = true;
}
if (opt_headers) {

@@ -82,0 +87,0 @@ opt_headers.names().forEach(function(name) {

@@ -65,2 +65,22 @@ 'use strict';

it('should send request with credentials', function(done) {
let withCredentials = true;
Ajax.request('/url', 'POST', null, null, null, null, false, withCredentials)
.then(function(xhrResponse) {
assert.ok(xhrResponse.withCredentials);
done();
});
this.requests[0].respond(200);
});
it('should send request without credentials', function(done) {
let withCredentials = false;
Ajax.request('/url', 'POST', null, null, null, null, false, withCredentials)
.then(function(xhrResponse) {
assert.notOk(xhrResponse.withCredentials);
done();
});
this.requests[0].respond(200);
});
it('should send request with different http method', function(done) {

@@ -67,0 +87,0 @@ Ajax.request('/url', 'POST')

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