Skip to content
This repository has been archived by the owner on Mar 11, 2019. It is now read-only.

Commit

Permalink
Only set up 'body' if there is one
Browse files Browse the repository at this point in the history
  • Loading branch information
novemberborn committed Mar 13, 2012
1 parent 0e41edc commit 122cfb8
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions Request.js
Expand Up @@ -34,18 +34,21 @@ define([
headers: {
enumerable: true,
value: req.headers
},
}
});

/**
* node-http-server.Request#body -> node-stream.Stream
*
* A stream for the request body.
**/
body: {
/**
* node-http-server.Request#body -> node-stream.Stream
*
* A stream for the request body, unless the request method is GET, DELETE
* or HEAD.
**/
if(req.method !== "GET" && req.method !== "DELETE" && req.method !== "HEAD"){
Object.defineProperty(this, "body", {
enumerable: true,
value: new Stream(req)
}
});
});
}

/**
* node-http-server.Request#expectContinue -> promise.Deferred
Expand Down

0 comments on commit 122cfb8

Please sign in to comment.