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 3.4.3 to 3.4.4

7

History.md

@@ -0,1 +1,8 @@

# 3.4.3 (2017-02-14)
* Fixed being able to define own parsers when their mime type starts with `text/` (Damien Clark)
* `withCredentials(false)` (Andy Woods)
* Use `formData.on` instead of `.once` (Kornel Lesiński)
* Ignore `attach("file",null)` (Kornel Lesiński)
# 3.4.1 (2017-01-29)

@@ -2,0 +9,0 @@

13

lib/client.js

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

var Emitter = require('emitter');
var Emitter = require('component-emitter');
var RequestBase = require('./request-base');

@@ -505,4 +505,4 @@ var isObject = require('./is-object');

* @param {String} user
* @param {String} pass
* @param {Object} options with 'type' property 'auto' or 'basic' (default 'basic')
* @param {String} [pass] optional in case of using 'bearer' as type
* @param {Object} options with 'type' property 'auto', 'basic' or 'bearer' (default 'basic')
* @return {Request} for chaining

@@ -513,2 +513,5 @@ * @api public

Request.prototype.auth = function(user, pass, options){
if (typeof pass === 'object' && pass !== null) { // pass is optional and can substitute for options
options = pass;
}
if (!options) {

@@ -529,2 +532,6 @@ options = {

break;
case 'bearer': // usage would be .auth(accessToken, { type: 'bearer' })
this.set('Authorization', 'Bearer ' + user);
break;
}

@@ -531,0 +538,0 @@ return this;

@@ -471,5 +471,7 @@

* .auth('tobi')
* .auth(accessToken, { type: 'bearer' })
*
* @param {String} user
* @param {String} pass
* @param {String} [pass]
* @param {Object} [options] options with authorization type 'basic' or 'bearer' ('basic' is default)
* @return {Request} for chaining

@@ -479,7 +481,17 @@ * @api public

Request.prototype.auth = function(user, pass){
Request.prototype.auth = function(user, pass, options){
if (1 === arguments.length) pass = '';
if (!~user.indexOf(':')) user = user + ':';
var str = new Buffer(user + pass).toString('base64');
return this.set('Authorization', 'Basic ' + str);
if (2 === arguments.length && typeof pass === 'object') options = pass;
if (!options) {
options = { type: 'basic' };
}
switch (options.type) {
case 'bearer':
return this.set('Authorization', 'Bearer ' + user);
default: // 'basic'
if (!~user.indexOf(':')) user = user + ':';
var str = new Buffer(user + pass).toString('base64');
return this.set('Authorization', 'Basic ' + str);
}
};

@@ -827,3 +839,3 @@

buffer = true;
} else if (isImage(mime)) {
} else if (isImageOrVideo(mime)) {
parser = exports.parse.image;

@@ -1014,15 +1026,6 @@ buffer = true; // For backwards-compatibility buffering default is ad-hoc MIME-dependent

/**
* Check if `mime` is image
*
* @param {String} mime
* @return {Boolean}
* @api public
*/
function isImageOrVideo(mime) {
var type = mime.split('/')[0];
function isImage(mime) {
var parts = mime.split('/');
var type = parts[0];
return 'image' == type;
return 'image' == type || 'video' == type;
}

@@ -1029,0 +1032,0 @@

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

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

"./lib/node/index.js": "./lib/client.js",
"emitter": "component-emitter",
"./test/support/server.js": "./test/support/blank.js"

@@ -58,0 +57,0 @@ },

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

var Emitter = require('emitter');
var Emitter = require('component-emitter');
var RequestBase = require('./request-base');

@@ -1516,4 +1516,4 @@ var isObject = require('./is-object');

* @param {String} user
* @param {String} pass
* @param {Object} options with 'type' property 'auto' or 'basic' (default 'basic')
* @param {String} [pass] optional in case of using 'bearer' as type
* @param {Object} options with 'type' property 'auto', 'basic' or 'bearer' (default 'basic')
* @return {Request} for chaining

@@ -1524,2 +1524,5 @@ * @api public

Request.prototype.auth = function(user, pass, options){
if (typeof pass === 'object' && pass !== null) { // pass is optional and can substitute for options
options = pass;
}
if (!options) {

@@ -1540,2 +1543,6 @@ options = {

break;
case 'bearer': // usage would be .auth(accessToken, { type: 'bearer' })
this.set('Authorization', 'Bearer ' + user);
break;
}

@@ -1941,3 +1948,3 @@ return this;

},{"./is-function":1,"./is-object":2,"./request-base":3,"./response-base":4,"./should-retry":5,"emitter":7}]},{},[8])(8)
},{"./is-function":1,"./is-object":2,"./request-base":3,"./response-base":4,"./should-retry":5,"component-emitter":7}]},{},[8])(8)
});
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