Comparing version 0.1.4 to 0.2.0
@@ -5,3 +5,3 @@ { | ||
"description": "http benchmark by nodejs", | ||
"version": "0.1.4", | ||
"version": "0.2.0", | ||
"repository": { | ||
@@ -8,0 +8,0 @@ "type": "git", |
@@ -167,6 +167,22 @@ var http = require('http') | ||
// Add POST Headers for POST Requests | ||
if(requestOptions.method === 'POST' && task.body) { | ||
headers['Content-Type'] = 'application/x-www-form-urlencoded' | ||
headers['Content-Length'] = querystring.stringify(task.body).length | ||
} | ||
var reqStartTime = Date.now(); | ||
var req; | ||
// Add QueryString to URL for GET Requests with Parameters | ||
if(requestOptions.method === 'GET' && task.query) { | ||
// Reset query string if present | ||
var hasQuery = requestOptions.path.indexOf('?') | ||
if(hasQuery > 0) { | ||
requestOptions.path = requestOptions.path.substring(0,hasQuery) | ||
} | ||
requestOptions.path = requestOptions.path + "?" + querystring.stringify(task.query) | ||
} | ||
if (options.sslProtocol && options.sslProtocol === true) { | ||
console.log("here"); | ||
req = https.request(requestOptions,handleRequest); | ||
@@ -222,2 +238,4 @@ } else { | ||
// Add POST Body for POST requests | ||
if(requestOptions.method === 'POST' && task.body) { | ||
@@ -224,0 +242,0 @@ req.write(querystring.stringify(task.body)); |
@@ -129,3 +129,2 @@ var util = require('util') | ||
return this.request({ | ||
// FIXME | ||
path: url | ||
@@ -139,3 +138,2 @@ , method: 'GET' | ||
return this.request({ | ||
// FIXME | ||
path: url | ||
@@ -142,0 +140,0 @@ , method: 'POST' |
24976
662