From 96d38cb7454e8c4d9ff878316465707335b231d0 Mon Sep 17 00:00:00 2001 From: Daniel Ilkovich Date: Thu, 15 Dec 2011 17:06:42 -0500 Subject: [PATCH] Patch for Issue #71 This resolves the issue where a data element is not passed in request body with assert.response. --- bin/expresso | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bin/expresso b/bin/expresso index fdad22c..3f339f3 100755 --- a/bin/expresso +++ b/bin/expresso @@ -428,6 +428,12 @@ assert.response = function(server, req, res, msg) { process.nextTick(check); } + if (req.method && req.method.toLowerCase() != 'get') { + if(!req.headers) req.headers = {} + req.headers['Content-Type'] = req.headers['Content-Type'] || 'application/x-www-form-urlencoded'; + req.headers['Content-Length'] = req.headers['Content-Length'] || (req.data && req.data.length) || (req.body && req.body.length) || 0; + } + // The socket was created but is not yet listening, so keep deferring if (!server.__listening) { server.__deferred.push(issue);