Comparing version 0.2.4 to 0.2.6
@@ -110,6 +110,7 @@ ////////////////////////////////////////// | ||
method: method, | ||
headers: headers, | ||
agent: options.agent || http.globalAgent | ||
headers: headers | ||
} | ||
if (typeof options.agent != 'undefined') http_opts.agent = options.agent; | ||
if(data) { | ||
@@ -243,3 +244,3 @@ if(options.multipart){ | ||
var filename = part.filename || part.file ? path.basename(part.file) : name; | ||
var filename = part.filename ? part.filename : part.file ? path.basename(part.file) : name; | ||
if(part.buffer) return append(part.buffer, filename); | ||
@@ -246,0 +247,0 @@ |
{ | ||
"name": "needle" | ||
, "version": "0.2.4" | ||
, "version": "0.2.6" | ||
, "description": "Tiny yet featureful HTTP client. With deflate & multipart POST support." | ||
@@ -5,0 +5,0 @@ , "keywords": ["http", "https", "client", "multipart", "deflate", "timeout", "basic-auth", "simple"] |
@@ -14,2 +14,3 @@ Needle | ||
client.get(url, [options], callback); | ||
client.head(url, [options], callback); | ||
client.post(url, data, [options], callback); | ||
@@ -16,0 +17,0 @@ client.put(url, data, [options], callback); |
@@ -60,3 +60,3 @@ // TODO: write specs. :) | ||
}, | ||
pixel: { filename:'black_pixel.gif', buffer: black_pixel, content_type: 'image/gif' }, | ||
pixel: { filename: 'black_pixel.gif', buffer: black_pixel, content_type: 'image/gif' }, | ||
} | ||
@@ -94,4 +94,12 @@ | ||
break; | ||
case 'all': | ||
simple_head(); | ||
simple_get(); | ||
auth_get(); | ||
proxy_get(); | ||
simple_post('http://posttestserver.com/post.php'); | ||
multipart_post('http://posttestserver.com/post.php?dir=example'); | ||
break; | ||
default: | ||
console.log("Usage: ./test.js [head|get|auth|proxy|multipart]") | ||
} |
16367
325
167