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

superagent

Package Overview
Dependencies
Maintainers
10
Versions
174
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

superagent - npm Package Compare versions

Comparing version 2.0.0-alpha.1 to 2.0.0-alpha.2

2

docs/index.md

@@ -21,3 +21,3 @@

The following [test documentation](docs/test.html) was generated with [Mocha's](http://visionmedia.github.com/mocha) "doc" reporter, and directly reflects the test suite. This provides an additional source of documentation.
The following [test documentation](docs/test.html) was generated with [Mocha's](http://mochajs.org/) "doc" reporter, and directly reflects the test suite. This provides an additional source of documentation.

@@ -24,0 +24,0 @@ ## Request basics

@@ -26,2 +26,3 @@ # 2.0.0

* Updated and improved tests (Peter Lyons)
* `request.head()` supports `.redirects(5)` call (Kornel Lesiński)

@@ -28,0 +29,0 @@ # 1.8.2 (2016-03-20)

@@ -98,2 +98,7 @@ /**

});
} else if (isObject(val)) {
for(var subkey in val) {
pushEncodedKeyValuePair(pairs, key + '[' + subkey + ']', val[subkey]);
}
return;
}

@@ -719,3 +724,17 @@ pairs.push(encodeURIComponent(key)

/**
* Compose querystring to append to req.url
*
* @api private
*/
Request.prototype._appendQueryString = function(){
var query = this._query.join('&');
if (query) {
this.url += ~this.url.indexOf('?')
? '&' + query
: '?' + query;
}
};
/**

@@ -733,3 +752,2 @@ * Initiate request, invoking callback `fn(res)`

var xhr = this.xhr = request.getXHR();
var query = this._query.join('&');
var timeout = this._timeout;

@@ -788,8 +806,3 @@ var data = this._formData || this._data;

// querystring
if (query) {
query = request.serializeObject(query);
this.url += ~this.url.indexOf('?')
? '&' + query
: '?' + query;
}
this._appendQueryString();

@@ -796,0 +809,0 @@ // initiate request

@@ -10,5 +10,5 @@ /**

function isObject(obj) {
return null != obj && 'object' == typeof obj;
return null !== obj && 'object' === typeof obj;
}
module.exports = isObject;

@@ -136,3 +136,3 @@

this._redirects = 0;
this.redirects(5);
this.redirects(method === 'HEAD' ? 0 : 5);
this.cookies = '';

@@ -204,16 +204,2 @@ this.qs = {};

/**
* Set the max redirects to `n`.
*
* @param {Number} n
* @return {Request} for chaining
* @api public
*/
Request.prototype.redirects = function(n){
debug('max redirects %s', n);
this._maxRedirects = n;
return this;
};
/**
* Return a new `Part` for this request.

@@ -708,2 +694,11 @@ *

if (self.piped) {
return;
}
// redirect
if (redirect && self._redirects++ != max) {
return self._redirect(res);
}
if ('HEAD' == self.method) {

@@ -719,11 +714,2 @@ var response = new Response(self);

if (self.piped) {
return;
}
// redirect
if (redirect && self._redirects++ != max) {
return self._redirect(res);
}
// zlib support

@@ -730,0 +716,0 @@ if (self._shouldUnzip(res)) {

@@ -196,2 +196,7 @@

Response.prototype.setStatusProperties = function(status){
console.warn("In superagent 2.x setStatusProperties is a private method");
return this._setStatusProperties(status);
};
/**

@@ -198,0 +203,0 @@ * To json.

@@ -223,3 +223,15 @@ /**

/**
* Set the max redirects to `n`. Does noting in browser XHR implementation.
*
* @param {Number} n
* @return {Request} for chaining
* @api public
*/
exports.redirects = function(n){
this._maxRedirects = n;
return this;
};
/**

@@ -226,0 +238,0 @@ * Convert to a plain javascript object (not JSON string) of scalar properties.

{
"name": "superagent",
"version": "2.0.0-alpha.1",
"version": "2.0.0-alpha.2",
"description": "elegant & feature rich browser / node HTTP with a fluent API",

@@ -5,0 +5,0 @@ "scripts": {

@@ -43,7 +43,7 @@ # SuperAgent [![Build Status](https://travis-ci.org/visionmedia/superagent.svg?branch=master)](https://travis-ci.org/visionmedia/superagent)

- Latest Chrome
- IE9 through latest
- IE10 through latest. IE9 with polyfills.
- Latest iPhone
- Latest Safari
Even though IE9 is supported, a polyfill `window.btoa` is needed to use basic auth.
Even though IE9 is supported, a polyfill for `window.FormData` is required for `.field()`, and `window.btoa` is needed to use basic auth.

@@ -80,2 +80,3 @@ # Plugins

* [superagent-httpbackend](https://www.npmjs.com/package/superagent-httpbackend) - stub out requests using AngularJS' $httpBackend syntax
* [superagent-throttle](https://github.com/leviwheatcroft/superagent-throttle) - queues and intelligently throttles requests

@@ -82,0 +83,0 @@ Please prefix your plugin with `superagent-*` so that it can easily be found by others.

@@ -1,2 +0,2 @@

!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.superagent=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.superagent = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
/**

@@ -11,3 +11,3 @@ * Check if `obj` is an object.

function isObject(obj) {
return null != obj && 'object' == typeof obj;
return null !== obj && 'object' === typeof obj;
}

@@ -240,3 +240,15 @@

/**
* Set the max redirects to `n`. Does noting in browser XHR implementation.
*
* @param {Number} n
* @return {Request} for chaining
* @api public
*/
exports.redirects = function(n){
this._maxRedirects = n;
return this;
};
/**

@@ -674,2 +686,7 @@ * Convert to a plain javascript object (not JSON string) of scalar properties.

});
} else if (isObject(val)) {
for(var subkey in val) {
pushEncodedKeyValuePair(pairs, key + '[' + subkey + ']', val[subkey]);
}
return;
}

@@ -1295,3 +1312,17 @@ pairs.push(encodeURIComponent(key)

/**
* Compose querystring to append to req.url
*
* @api private
*/
Request.prototype._appendQueryString = function(){
var query = this._query.join('&');
if (query) {
this.url += ~this.url.indexOf('?')
? '&' + query
: '?' + query;
}
};
/**

@@ -1309,3 +1340,2 @@ * Initiate request, invoking callback `fn(res)`

var xhr = this.xhr = request.getXHR();
var query = this._query.join('&');
var timeout = this._timeout;

@@ -1364,8 +1394,3 @@ var data = this._formData || this._data;

// querystring
if (query) {
query = request.serializeObject(query);
this.url += ~this.url.indexOf('?')
? '&' + query
: '?' + query;
}
this._appendQueryString();

@@ -1372,0 +1397,0 @@ // initiate request

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