Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #73 from savardc/statusMessage
Add status message to response object
  • Loading branch information
hueniverse committed Aug 26, 2016
2 parents 4d63193 + 6859dca commit 981a2ae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions API.md
Expand Up @@ -27,6 +27,7 @@ Injects a fake request into an HTTP server.
- `res` - the simulated response object.
- `headers` - an object containing the response headers.
- `statusCode` - the HTTP status code.
- `statusMessage` - the HTTP status message.
- `payload` - the payload as a UTF-8 encoded string.
- `rawPayload` - the raw payload as a Buffer.
- `trailers` - an object containing the response trailers.
Expand Down
6 changes: 5 additions & 1 deletion test/index.js
Expand Up @@ -578,14 +578,18 @@ describe('writeHead()', () => {
it('returns single buffer payload', (done) => {

const reply = 'Hello World';
const statusCode = 200;
const statusMessage = 'OK';
const dispatch = function (req, res) {

res.writeHead(200, 'OK', { 'Content-Type': 'text/plain', 'Content-Length': reply.length });
res.writeHead(statusCode, statusMessage, { 'Content-Type': 'text/plain', 'Content-Length': reply.length });
res.end(reply);
};

Shot.inject(dispatch, { method: 'get', url: '/' }, (res) => {

expect(res.statusCode).to.equal(statusCode);
expect(res.statusMessage).to.equal(statusMessage);
expect(res.payload).to.equal(reply);
done();
});
Expand Down

0 comments on commit 981a2ae

Please sign in to comment.