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.1.0-beta.1 to 2.1.0

5

component.json
{
"name": "superagent",
"repo": "visionmedia/superagent",
"version": "1.9.0",
"version": "2.1.0",
"description": "elegant & feature rich browser / node HTTP with a fluent API",

@@ -17,6 +17,5 @@ "keywords": [

"dependencies": {
"component/emitter": "*",
"component/reduce": "*"
"component/emitter": "*"
},
"license": "MIT"
}

33

docs/index.md

@@ -230,4 +230,6 @@

Super Agent will parse known response-body data for you, currently supporting `application/x-www-form-urlencoded`, `application/json`, and `multipart/form-data`. You can set a custom parser (that takes precedence over built-in parsers) with the `.parse(fn)` method.
Super Agent will parse known response-body data for you, currently supporting `application/x-www-form-urlencoded`, `application/json`, and `multipart/form-data`.
You can set a custom parser (that takes precedence over built-in parsers) with the `.buffer(true).parse(fn)` method. If response buffering is not enabled (`.buffer(false)`) then the `response` event will be emitted without waiting for the body parser to finish, so `response.body` won't be available.
### JSON / Urlencoded

@@ -317,10 +319,6 @@

## Basic authentication
## Authentication
Basic auth is currently provided by the _node_ client in two forms, first via the URL as "user:pass":
In both Node and browsers auth available via the `.auth()` method:
request.get('http://tobi:learnboost@local').end(callback);
As well as via the `.auth()` method:
request

@@ -331,2 +329,11 @@ .get('http://local')

In the _Node_ client Basic auth can be in the URL as "user:pass":
request.get('http://tobi:learnboost@local').end(callback);
By default only `Basic` auth is used. In browser you can add `{type:'auto'}` to enable all methods built-in in the browser (Digest, NTLM, etc.):
request.auth('digest', 'secret', {type:'auto'})
## Following redirects

@@ -453,3 +460,3 @@

Superagent's request is a "thenable" object that's compatible with JavaScript promises.
Superagent's request is a "thenable" object that's compatible with JavaScript promises and `async`/`await` syntax.

@@ -465,4 +472,10 @@ Libraries like [co](https://github.com/tj/co) or a web framework like [koa](https://github.com/koajs/koa) can `yield` on any superagent method:

## Using browser version in electron
## Browser and node versions
[Electron](http://electron.atom.io/) developers report if you would prefer to use the browser version of superagent instead of the node version, you can `require('superagent/superagent')`. Your requests will now show up in the chrome developer tools network tab. Note this environment is not covered by automated test suite and not officially supported.
Superagent has two implementations: one for web browsers (using XHR) and one for Node.JS (using core http module). By default Browserify and WebPack will pick the browser version.
If want to use WebPack to compile code for Node.JS, you *must* specify [node target](webpack.github.io/docs/configuration.html#target) in its configuration.
### Using browser version in electron
[Electron](http://electron.atom.io/) developers report if you would prefer to use the browser version of superagent instead of the Node version, you can `require('superagent/superagent')`. Your requests will now show up in the Chrome developer tools Network tab. Note this environment is not covered by automated test suite and not officially supported.

@@ -0,1 +1,7 @@

# 2.1.0
* Refactored async parsers. Now the `end` callback waits for async parsers to finish (Kornel Lesiński)
* Errors thrown in `.end()` callback don't cause the callback to be called twice (Kornel Lesiński)
* Added `headers` to `toJSON()` (Tao)
# 2.0.0

@@ -2,0 +8,0 @@

/**
* Module dependencies.
*/
var Emitter = require('emitter');
var reduce = require('reduce');
var requestBase = require('./request-base');
var isObject = require('./is-object');
/**
* Root reference for iframes.

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

} else { // Other environments
console.warn("Using browser-only version of superagent in non-browser environment");
root = this;
}
var Emitter = require('emitter');
var requestBase = require('./request-base');
var isObject = require('./is-object');
/**

@@ -51,3 +47,3 @@ * Noop.

}
return false;
throw Error("Browser-only verison of superagent could not find XHR");
};

@@ -257,6 +253,6 @@

function params(str){
return reduce(str.split(/ *; */), function(obj, str){
var parts = str.split(/ *= */)
, key = parts.shift()
, val = parts.shift();
return str.split(/ *; */).reduce(function(obj, str){
var parts = str.split(/ *= */),
key = parts.shift(),
val = parts.shift();

@@ -861,4 +857,4 @@ if (key && val) obj[key] = val;

* @param {String} url
* @param {Mixed|Function} data or fn
* @param {Function} fn
* @param {Mixed|Function} [data] or fn
* @param {Function} [fn]
* @return {Request}

@@ -880,4 +876,4 @@ * @api public

* @param {String} url
* @param {Mixed|Function} data or fn
* @param {Function} fn
* @param {Mixed|Function} [data] or fn
* @param {Function} [fn]
* @return {Request}

@@ -899,4 +895,4 @@ * @api public

* @param {String} url
* @param {Mixed|Function} data or fn
* @param {Function} fn
* @param {Mixed|Function} [data] or fn
* @param {Function} [fn]
* @return {Request}

@@ -918,3 +914,3 @@ * @api public

* @param {String} url
* @param {Function} fn
* @param {Function} [fn]
* @return {Request}

@@ -937,4 +933,4 @@ * @api public

* @param {String} url
* @param {Mixed} data
* @param {Function} fn
* @param {Mixed} [data]
* @param {Function} [fn]
* @return {Request}

@@ -956,4 +952,4 @@ * @api public

* @param {String} url
* @param {Mixed} data
* @param {Function} fn
* @param {Mixed} [data]
* @param {Function} [fn]
* @return {Request}

@@ -975,4 +971,4 @@ * @api public

* @param {String} url
* @param {Mixed|Function} data or fn
* @param {Function} fn
* @param {Mixed|Function} [data] or fn
* @param {Function} [fn]
* @return {Request}

@@ -979,0 +975,0 @@ * @api public

@@ -249,3 +249,4 @@ /**

url: this.url,
data: this._data
data: this._data,
headers: this._header
};

@@ -252,0 +253,0 @@ };

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

@@ -34,3 +34,2 @@ "scripts": {

"debug": "^2.2.0",
"reduce-component": "^1.0.1",
"extend": "^3.0.0",

@@ -58,3 +57,2 @@ "form-data": "1.0.0-rc4",

"emitter": "component-emitter",
"reduce": "reduce-component",
"./test/support/server.js": "./test/support/blank.js"

@@ -61,0 +59,0 @@ },

@@ -1,5 +0,3 @@

# SuperAgent [![Build Status](https://travis-ci.org/visionmedia/superagent.svg?branch=master)](https://travis-ci.org/visionmedia/superagent)
# SuperAgent
[![Sauce Test Status](https://saucelabs.com/browser-matrix/shtylman-superagent.svg)](https://saucelabs.com/u/shtylman-superagent)
SuperAgent is a small progressive __client-side__ HTTP request library, and __Node.js__ module with the same API, sporting many high-level HTTP client features. View the [docs](http://visionmedia.github.io/superagent/).

@@ -80,2 +78,3 @@

* [superagent-throttle](https://github.com/leviwheatcroft/superagent-throttle) - queues and intelligently throttles requests
* [superagent-charset](https://github.com/magicdawn/superagent-charset) - add charset support for node's superagent

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

@@ -265,3 +265,4 @@ (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){

url: this.url,
data: this._data
data: this._data,
headers: this._header
};

@@ -565,37 +566,3 @@ };

},{}],5:[function(require,module,exports){
/**
* Reduce `arr` with `fn`.
*
* @param {Array} arr
* @param {Function} fn
* @param {Mixed} initial
*
* TODO: combatible error handling?
*/
module.exports = function(arr, fn, initial){
var idx = 0;
var len = arr.length;
var curr = arguments.length == 3
? initial
: arr[idx++];
while (idx < len) {
curr = fn.call(null, curr, arr[idx], ++idx, arr);
}
return curr;
};
},{}],6:[function(require,module,exports){
/**
* Module dependencies.
*/
var Emitter = require('emitter');
var reduce = require('reduce');
var requestBase = require('./request-base');
var isObject = require('./is-object');
/**
* Root reference for iframes.

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

} else { // Other environments
console.warn("Using browser-only version of superagent in non-browser environment");
root = this;
}
var Emitter = require('emitter');
var requestBase = require('./request-base');
var isObject = require('./is-object');
/**

@@ -641,3 +613,3 @@ * Noop.

}
return false;
throw Error("Browser-only verison of superagent could not find XHR");
};

@@ -847,6 +819,6 @@

function params(str){
return reduce(str.split(/ *; */), function(obj, str){
var parts = str.split(/ *= */)
, key = parts.shift()
, val = parts.shift();
return str.split(/ *; */).reduce(function(obj, str){
var parts = str.split(/ *= */),
key = parts.shift(),
val = parts.shift();

@@ -1451,4 +1423,4 @@ if (key && val) obj[key] = val;

* @param {String} url
* @param {Mixed|Function} data or fn
* @param {Function} fn
* @param {Mixed|Function} [data] or fn
* @param {Function} [fn]
* @return {Request}

@@ -1470,4 +1442,4 @@ * @api public

* @param {String} url
* @param {Mixed|Function} data or fn
* @param {Function} fn
* @param {Mixed|Function} [data] or fn
* @param {Function} [fn]
* @return {Request}

@@ -1489,4 +1461,4 @@ * @api public

* @param {String} url
* @param {Mixed|Function} data or fn
* @param {Function} fn
* @param {Mixed|Function} [data] or fn
* @param {Function} [fn]
* @return {Request}

@@ -1508,3 +1480,3 @@ * @api public

* @param {String} url
* @param {Function} fn
* @param {Function} [fn]
* @return {Request}

@@ -1527,4 +1499,4 @@ * @api public

* @param {String} url
* @param {Mixed} data
* @param {Function} fn
* @param {Mixed} [data]
* @param {Function} [fn]
* @return {Request}

@@ -1546,4 +1518,4 @@ * @api public

* @param {String} url
* @param {Mixed} data
* @param {Function} fn
* @param {Mixed} [data]
* @param {Function} [fn]
* @return {Request}

@@ -1565,4 +1537,4 @@ * @api public

* @param {String} url
* @param {Mixed|Function} data or fn
* @param {Function} fn
* @param {Mixed|Function} [data] or fn
* @param {Function} [fn]
* @return {Request}

@@ -1580,3 +1552,3 @@ * @api public

},{"./is-object":1,"./request":3,"./request-base":2,"emitter":4,"reduce":5}]},{},[6])(6)
},{"./is-object":1,"./request":3,"./request-base":2,"emitter":4}]},{},[5])(5)
});

Sorry, the diff of this file is not supported yet

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