superagent
Advanced tools
Comparing version 0.14.5 to 0.14.6
@@ -5,3 +5,3 @@ { | ||
"description": "awesome http requests", | ||
"version": "0.14.5", | ||
"version": "0.14.6", | ||
"keywords": [ | ||
@@ -8,0 +8,0 @@ "http", |
0.14.6 / 2013-05-23 | ||
================== | ||
* fix HEAD unzip bug | ||
0.14.5 / 2013-05-23 | ||
@@ -3,0 +8,0 @@ ================== |
@@ -541,3 +541,3 @@ /*! | ||
var req = this.req = mod.request(options); | ||
req.setHeader('Accept-Encoding', 'gzip, deflate'); | ||
if ('HEAD' != options.method) req.setHeader('Accept-Encoding', 'gzip, deflate'); | ||
this.protocol = url.protocol; | ||
@@ -584,3 +584,3 @@ this.host = url.host; | ||
this.clearTimeout(); | ||
if (this.called) return; | ||
if (this.called) return console.warn('double callback!'); | ||
this.called = true; | ||
@@ -641,2 +641,3 @@ if (2 == fn.length) return fn(err, res); | ||
var mime = utils.type(res.headers['content-type'] || ''); | ||
var len = res.headers['content-length']; | ||
var type = mime.split('/'); | ||
@@ -643,0 +644,0 @@ var subtype = type[1]; |
{ | ||
"name": "superagent", | ||
"version": "0.14.5", | ||
"version": "0.14.6", | ||
"description": "elegant & feature rich browser / node HTTP with a fluent API", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
37
test.js
var request = require('./'); | ||
var http = require('http'); | ||
var parse = require('url').parse; | ||
request | ||
.get('http://arstechnica.com/information-technology/2013/05/fios-customer-discovers-the-limits-of-unlimited-data-77-tb-in-month/') | ||
.end(function(err, res){ | ||
console.log(err); | ||
console.log(res.header); | ||
console.log(res.text); | ||
}) | ||
var url = 'http://arstechnica.com/information-technology/2013/05/fios-customer-discovers-the-limits-of-unlimited-data-77-tb-in-month/'; | ||
var n = 10; | ||
// var options = parse(url); | ||
// options.method = 'HEAD'; | ||
// options.agent = false; | ||
// while (n--) { | ||
// var req = http.request(options); | ||
// req.on('response', function(res){ | ||
// console.log(res.statusCode); | ||
// }); | ||
// req.on('error', function(err){ | ||
// console.log(err.message); | ||
// }); | ||
// req.end(); | ||
// } | ||
while (n--) { | ||
request | ||
.head(url) | ||
.end(function(err, res){ | ||
if (err) return console.error(err.message); | ||
console.log(res.status); | ||
}) | ||
} |
103391
3527
3