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

superagent

Package Overview
Dependencies
Maintainers
6
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 0.18.0 to 0.18.1

lib/node/parsers/image.js

30

docs/index.md

@@ -7,3 +7,3 @@ # SuperAgent

.post('/api/pet')
.data({ name: 'Manny', species: 'cat' })
.send({ name: 'Manny', species: 'cat' })
.set('X-API-Key', 'foobar')

@@ -80,3 +80,3 @@ .set('Accept', 'application/json')

.get('/search')
.data({ query: 'tobi the ferret' })
.send({ query: 'tobi the ferret' })
.end(function(res){

@@ -128,9 +128,9 @@

The `.data()` method accepts objects, which when used with the __GET__ method will form a query-string. The following will produce the path `/search?query=Manny&range=1..5&order=desc`.
The `.send()` method accepts objects, which when used with the __GET__ method will form a query-string. The following will produce the path `/search?query=Manny&range=1..5&order=desc`.
request
.get('/search')
.data({ query: 'Manny' })
.data({ range: '1..5' })
.data({ order: 'desc' })
.send({ query: 'Manny' })
.send({ range: '1..5' })
.send({ order: 'desc' })
.end(function(res){

@@ -140,7 +140,7 @@

The `.data()` method accepts strings as well:
The `.send()` method accepts strings as well:
request
.get('/querystring')
.data('search=Manny&range=1..5')
.send('search=Manny&range=1..5')
.end(function(res){

@@ -156,3 +156,3 @@

.set('Content-Type', 'application/json')
.data('{"name":"tj","pet":"tobi"})
.send('{"name":"tj","pet":"tobi"})
.end(callback)

@@ -163,10 +163,10 @@

request.post('/user')
.data({ name: 'tj', pet: 'tobi' })
.send({ name: 'tj', pet: 'tobi' })
.end(callback)
Or using multiple `.data()` calls:
Or using multiple `.send()` calls:
request.post('/user')
.data({ name: 'tj' })
.data({ pet: 'tobi' })
.send({ name: 'tj' })
.send({ pet: 'tobi' })
.end(callback)

@@ -178,4 +178,4 @@

.type('form')
.data({ name: 'tj' })
.data({ pet: 'tobi' })
.send({ name: 'tj' })
.send({ pet: 'tobi' })
.end(callback)

@@ -182,0 +182,0 @@

0.18.1 / 2014-07-05
==================
* Upgrade cookiejar dependency (juanpin)
* Support image mime types (nebulade)
* Make .agent chainable (kof)
* Upgrade debug (TooTallNate)
* Fix docs (aheckmann)
0.18.0 / 2014-04-29

@@ -3,0 +12,0 @@ ===================

@@ -241,4 +241,5 @@

Request.prototype.agent = function(agent){
if (agent) this._agent = agent;
return this._agent;
if (!arguments.length) return this._agent;
this._agent = agent;
return this;
};

@@ -841,2 +842,15 @@

// check for images, one more special treatment
if (isImage(mime)) {
exports.parse.image(res, function(err, obj){
if (err) return self.callback(err);
var response = new Response(req, res);
response.body = obj;
response.redirects = self._redirectList;
self.emit('end');
self.callback(null, response);
});
return;
}
// by default only buffer text/*, json

@@ -990,2 +1004,18 @@ // and messed up thing from hell

/**
* Check if `mime` is image
*
* @param {String} mime
* @return {Boolean}
* @api public
*/
function isImage(mime) {
var parts = mime.split('/');
var type = parts[0];
var subtype = parts[1];
return 'image' == type;
}
/**
* Check if we should follow the redirect `code`.

@@ -992,0 +1022,0 @@ *

@@ -5,1 +5,2 @@

exports.text = require('./text');
exports.image = require('./image');
{
"name": "superagent",
"version": "0.18.0",
"version": "0.18.1",
"description": "elegant & feature rich browser / node HTTP with a fluent API",

@@ -25,10 +25,10 @@ "scripts": {

"formidable": "1.0.14",
"mime": "1.2.5",
"mime": "1.2.11",
"component-emitter": "1.1.2",
"methods": "0.0.1",
"cookiejar": "1.3.2",
"debug": "~0.7.2",
"methods": "1.0.1",
"cookiejar": "2.0.1",
"debug": "~1.0.1",
"reduce-component": "1.0.1",
"extend": "~1.2.1",
"form-data": "0.1.2",
"form-data": "0.1.3",
"readable-stream": "1.0.27-1"

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