Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix for Issue #71 #157

Open
wants to merge 1 commit into from

1 participant

@ilkovich

This resolves the issue where a data element is not passed in request body
with assert.response.

@ilkovich ilkovich Patch for Issue #71
This resolves the issue where a data element is not passed in request body
with assert.response.
96d38cb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 15, 2011
  1. @ilkovich

    Patch for Issue #71

    ilkovich authored
    This resolves the issue where a data element is not passed in request body
    with assert.response.
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 0 deletions.
  1. +6 −0 bin/expresso
View
6 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);
Something went wrong with that request. Please try again.