Socket
Socket
Sign inDemoInstall

superagent

Package Overview
Dependencies
Maintainers
1
Versions
173
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 0.13.0 to 0.14.0

53

build/build.js
;(function(){
/**
* hasOwnProperty.
*/
var has = Object.prototype.hasOwnProperty;
/**
* Require the given path.

@@ -86,6 +79,6 @@ *

var path = paths[i];
if (has.call(require.modules, path)) return path;
if (require.modules.hasOwnProperty(path)) return path;
}
if (has.call(require.aliases, index)) {
if (require.aliases.hasOwnProperty(index)) {
return require.aliases[index];

@@ -144,3 +137,3 @@ }

require.alias = function(from, to) {
if (!has.call(require.modules, from)) {
if (!require.modules.hasOwnProperty(from)) {
throw new Error('Failed to alias "' + from + '", it does not exist');

@@ -207,3 +200,3 @@ }

localRequire.exists = function(path) {
return has.call(require.modules, localRequire.resolve(path));
return require.modules.hasOwnProperty(localRequire.resolve(path));
};

@@ -831,2 +824,3 @@

this.header = {};
this._header = {};
this.set('X-Requested-With', 'XMLHttpRequest');

@@ -916,3 +910,4 @@ this.on('end', function(){

}
this.header[field.toLowerCase()] = val;
this._header[field.toLowerCase()] = val;
this.header[field] = val;
return this;

@@ -922,2 +917,14 @@ };

/**
* Get case-insensitive header `field` value.
*
* @param {String} field
* @return {String}
* @api private
*/
Request.prototype.getHeader = function(field){
return this._header[field.toLowerCase()];
};
/**
* Set Content-Type to `type`, mapping values from `request.types`.

@@ -950,2 +957,17 @@ *

/**
* Set Authorization field value with `user` and `pass`.
*
* @param {String} user
* @param {String} pass
* @return {Request} for chaining
* @api public
*/
Request.prototype.auth = function(user, pass){
var str = btoa(user + ':' + pass);
this.set('Authorization', 'Basic ' + str);
return this;
};
/**
* Add query-string `val`.

@@ -1023,3 +1045,3 @@ *

var obj = isObject(data);
var type = this.header['content-type'];
var type = this.getHeader('Content-Type');

@@ -1033,3 +1055,3 @@ // merge

if (!type) this.type('form');
type = this.header['content-type'];
type = this.getHeader('Content-Type');
if ('application/x-www-form-urlencoded' == type) {

@@ -1169,3 +1191,3 @@ this._data = this._data

// serialize stuff
var serialize = request.serialize[this.header['content-type']];
var serialize = request.serialize[this.getHeader('Content-Type')];
if (serialize) data = serialize(data);

@@ -1176,2 +1198,3 @@ }

for (var field in this.header) {
if (null == this.header[field]) continue;
xhr.setRequestHeader(field, this.header[field]);

@@ -1178,0 +1201,0 @@ }

@@ -5,3 +5,3 @@ {

"description": "awesome http requests",
"version": "0.13.0",
"version": "0.14.0",
"keywords": [

@@ -8,0 +8,0 @@ "http",

0.14.0 / 2013-04-02
==================
* add client-side basic auth
* fix retaining of .set() header field case
0.13.0 / 2013-03-13

@@ -3,0 +9,0 @@ ==================

@@ -415,2 +415,3 @@

this.header = {};
this._header = {};
this.set('X-Requested-With', 'XMLHttpRequest');

@@ -500,3 +501,4 @@ this.on('end', function(){

}
this.header[field.toLowerCase()] = val;
this._header[field.toLowerCase()] = val;
this.header[field] = val;
return this;

@@ -506,2 +508,14 @@ };

/**
* Get case-insensitive header `field` value.
*
* @param {String} field
* @return {String}
* @api private
*/
Request.prototype.getHeader = function(field){
return this._header[field.toLowerCase()];
};
/**
* Set Content-Type to `type`, mapping values from `request.types`.

@@ -534,2 +548,17 @@ *

/**
* Set Authorization field value with `user` and `pass`.
*
* @param {String} user
* @param {String} pass
* @return {Request} for chaining
* @api public
*/
Request.prototype.auth = function(user, pass){
var str = btoa(user + ':' + pass);
this.set('Authorization', 'Basic ' + str);
return this;
};
/**
* Add query-string `val`.

@@ -607,3 +636,3 @@ *

var obj = isObject(data);
var type = this.header['content-type'];
var type = this.getHeader('Content-Type');

@@ -617,3 +646,3 @@ // merge

if (!type) this.type('form');
type = this.header['content-type'];
type = this.getHeader('Content-Type');
if ('application/x-www-form-urlencoded' == type) {

@@ -753,3 +782,3 @@ this._data = this._data

// serialize stuff
var serialize = request.serialize[this.header['content-type']];
var serialize = request.serialize[this.getHeader('Content-Type')];
if (serialize) data = serialize(data);

@@ -760,2 +789,3 @@ }

for (var field in this.header) {
if (null == this.header[field]) continue;
xhr.setRequestHeader(field, this.header[field]);

@@ -762,0 +792,0 @@ }

{
"name": "superagent",
"version": "0.13.0",
"version": "0.14.0",
"description": "elegant & feature rich browser / node HTTP with a fluent API",

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

@@ -52,3 +52,3 @@ # SuperAgent

.set('Accept', 'application/json')
.end(function(res){
.end(function(error, res){

@@ -61,3 +61,3 @@ });

```js
request.post('/api/pet', cat, function(res){
request.post('/api/pet', cat, function(error, res){

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