Socket
Socket
Sign inDemoInstall

superagent

Package Overview
Dependencies
Maintainers
10
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 3.8.1 to 3.8.2

16

docs/index.md

@@ -496,2 +496,18 @@

Note that you should **NOT** attempt to pipe the result of `.end()` or the `Response` object:
// Don't do either of these:
const stream = getAWritableStream();
const req = request
.get('/some.json')
// this pipes garbage to the stream and fails in unexpected ways
.end((err, response) => response.pipe(stream))
const req = request
.get('/some.json')
.end()
// this is also unsupported, .pipe calls .end for you.
.pipe(stream);
In a [future version](https://github.com/visionmedia/superagent/issues/1188) of superagent, improper calls to `pipe()` will fail.
## Multipart requests

@@ -498,0 +514,0 @@

4

lib/client.js

@@ -246,3 +246,5 @@ /**

function isJSON(mime) {
return /[\/+]json\b/.test(mime);
// should match /json or +json
// but not /json-seq
return /[\/+]json($|[^-\w])/.test(mime);
}

@@ -249,0 +251,0 @@

@@ -167,3 +167,3 @@ 'use strict';

* request.post('http://localhost/upload')
* .attach(new Buffer('<b>Hello world</b>'), 'hello.html')
* .attach('field', Buffer.from('<b>Hello world</b>'), 'hello.html')
* .end(callback);

@@ -692,12 +692,10 @@ * ```

try {
if (this._isResponseOK(res)) {
return fn(err, res);
if (!this._isResponseOK(res)) {
let msg = 'Unsuccessful HTTP response';
if (res) {
msg = http.STATUS_CODES[res.status] || msg;
}
err = new Error(msg);
err.status = res ? res.status : undefined;
}
let msg = 'Unsuccessful HTTP response';
if (res) {
msg = http.STATUS_CODES[res.status] || msg;
}
err = new Error(msg);
err.status = res ? res.status : undefined;
} catch (new_err) {

@@ -707,2 +705,7 @@ err = new_err;

}
// It's important that the callback is called outside try/catch
// to avoid double callback
if (!err) {
return fn(null, res);
}

@@ -1070,3 +1073,5 @@ err.response = res;

function isJSON(mime) {
return /[\/+]json\b/.test(mime);
// should match /json or +json
// but not /json-seq
return /[\/+]json($|[^-\w])/.test(mime);
}

@@ -1073,0 +1078,0 @@

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

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

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

function isJSON(mime) {
return /[\/+]json\b/.test(mime);
// should match /json or +json
// but not /json-seq
return /[\/+]json($|[^-\w])/.test(mime);
}

@@ -1359,0 +1361,0 @@

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