Skip to content
Browse files

test before callback. Added header on post

  • Loading branch information...
1 parent eb9c266 commit 38caf4c005f924e148d7d998fea3c2181080729b @masylum committed Jan 2, 2011
Showing with 8 additions and 6 deletions.
  1. +7 −5 lib/testosterone.js
  2. +1 −1 package.json
View
12 lib/testosterone.js
@@ -1,10 +1,9 @@
module.exports = function (config) {
config = config || {};
- // extend assert
var client = require('http').createClient(
- config.port || 80,
- config.host || 'localhost'
+ config.port || 80,
+ config.host || 'localhost'
),
sys = require('sys'),
testosterone = {},
@@ -29,6 +28,7 @@ module.exports = function (config) {
}
},
+ // extend assert
assert = (function () {
var assert = require('assert'),
functions = Object.keys(assert),
@@ -84,7 +84,9 @@ module.exports = function (config) {
if (data) {
if (typeof data === 'object') {
data = require('querystring').stringify(data);
- headers['content-type'] = headers['content-type'] || 'application/x-www-form-urlencoded';
+ if (req.method === 'POST') {
+ headers['content-type'] = headers['content-type'] || 'application/x-www-form-urlencoded';
+ }
}
}
@@ -164,9 +166,9 @@ module.exports = function (config) {
}
// Callback
- callback(response);
done_responses += 1;
test();
+ callback(response);
});
});
request.end();
View
2 package.json
@@ -1,7 +1,7 @@
{
"name": "testosterone",
"description": "Synchronous testing for virile http servers",
- "version": "0.0.5",
+ "version": "0.0.6",
"repository": "git://github.com/masylum/testosterone.git",
"author": "Pau Ramon Revilla <masylum@gmail.com>",
"directories": {

0 comments on commit 38caf4c

Please sign in to comment.
Something went wrong with that request. Please try again.