superagent
Advanced tools
Comparing version 0.9.1 to 0.9.2
@@ -5,5 +5,5 @@ { | ||
"description": "awesome http requests", | ||
"version": "0.9.0", | ||
"version": "0.9.2", | ||
"keywords": ["http", "ajax", "request", "agent"], | ||
"main": "lib/superagent.js" | ||
} |
0.9.2 / 2012-09-17 | ||
================== | ||
* add `.aborted` prop | ||
* add `.abort()`. Closes #115 | ||
0.9.1 / 2012-09-07 | ||
@@ -3,0 +9,0 @@ ================== |
@@ -106,6 +106,6 @@ | ||
function parseString(str) { | ||
var obj = {} | ||
, pairs = str.split('&') | ||
, parts | ||
, pair; | ||
var obj = {}; | ||
var pairs = str.split('&'); | ||
var parts; | ||
var pair; | ||
@@ -135,7 +135,7 @@ for (var i = 0, len = pairs.length; i < len; ++i) { | ||
request.types = { | ||
html: 'text/html' | ||
, json: 'application/json' | ||
, urlencoded: 'application/x-www-form-urlencoded' | ||
, 'form': 'application/x-www-form-urlencoded' | ||
, 'form-data': 'application/x-www-form-urlencoded' | ||
html: 'text/html', | ||
json: 'application/json', | ||
urlencoded: 'application/x-www-form-urlencoded', | ||
'form': 'application/x-www-form-urlencoded', | ||
'form-data': 'application/x-www-form-urlencoded' | ||
}; | ||
@@ -153,4 +153,4 @@ | ||
request.serialize = { | ||
'application/x-www-form-urlencoded': serialize | ||
, 'application/json': JSON.stringify | ||
'application/x-www-form-urlencoded': serialize, | ||
'application/json': JSON.stringify | ||
}; | ||
@@ -168,4 +168,4 @@ | ||
request.parse = { | ||
'application/x-www-form-urlencoded': parseString | ||
, 'application/json': JSON.parse | ||
'application/x-www-form-urlencoded': parseString, | ||
'application/json': JSON.parse | ||
}; | ||
@@ -183,8 +183,8 @@ | ||
function parseHeader(str) { | ||
var lines = str.split(/\r?\n/) | ||
, fields = {} | ||
, index | ||
, line | ||
, field | ||
, val; | ||
var lines = str.split(/\r?\n/); | ||
var fields = {}; | ||
var index; | ||
var line; | ||
var field; | ||
var val; | ||
@@ -410,2 +410,17 @@ lines.pop(); // trailing CRLF | ||
/** | ||
* Abort the request. | ||
* | ||
* @return {Request} | ||
* @api public | ||
*/ | ||
Request.prototype.abort = function(){ | ||
if (this.aborted) return; | ||
this.xhr.abort(); | ||
this.emit('abort'); | ||
this.aborted = true; | ||
return this; | ||
}; | ||
/** | ||
* Set header `field` to `val`, or multiple fields with one object. | ||
@@ -576,6 +591,6 @@ * | ||
Request.prototype.end = function(fn){ | ||
var self = this | ||
, xhr = this.xhr = getXHR() | ||
, query = this._query | ||
, data = this._data; | ||
var self = this; | ||
var xhr = this.xhr = getXHR(); | ||
var query = this._query; | ||
var data = this._data; | ||
@@ -582,0 +597,0 @@ // store callback |
{ | ||
"name": "superagent" | ||
, "version": "0.9.1" | ||
, "version": "0.9.2" | ||
, "description": "elegant & feature rich browser / node HTTP with a fluent API" | ||
@@ -5,0 +5,0 @@ , "keywords": ["http", "ajax", "request", "agent"] |
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
91892
2738
0