diff --git a/lib/request.js b/lib/request.js index 282ba52..758503e 100755 --- a/lib/request.js +++ b/lib/request.js @@ -82,7 +82,7 @@ exports = module.exports = internals.Request = function (options) { // Use _shot namespace to avoid collision with Node this._shot = { - payload: payload, + payload, isDone: false, simulate: options.simulate || {} }; diff --git a/lib/response.js b/lib/response.js index 683d3f1..b567b48 100755 --- a/lib/response.js +++ b/lib/response.js @@ -80,6 +80,7 @@ internals.payload = function (response) { }, headers: response._headers, statusCode: response.statusCode, + statusMessage: response.statusMessage, trailers: {} }; diff --git a/package.json b/package.json index a87a771..defaad1 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "shot", "description": "Injects a fake HTTP request/response into a node HTTP server", - "version": "3.1.1", + "version": "3.2.0", "repository": "git://github.com/hapijs/shot", "main": "lib/index.js", "keywords": [ @@ -15,7 +15,7 @@ }, "devDependencies": { "code": "3.x.x", - "lab": "10.x.x" + "lab": "11.x.x" }, "scripts": { "test": "lab -a code -t 100 -L", diff --git a/test/index.js b/test/index.js index 7fde7ed..98009ce 100755 --- a/test/index.js +++ b/test/index.js @@ -31,12 +31,15 @@ describe('inject()', () => { const dispatch = function (req, res) { + res.statusMessage = 'Super'; res.writeHead(200, { 'Content-Type': 'text/plain', 'Content-Length': output.length }); res.end(req.headers.host + '|' + req.url); }; Shot.inject(dispatch, 'http://example.com:8080/hello', (res) => { + expect(res.statusCode).to.equal(200); + expect(res.statusMessage).to.equal('Super'); expect(res.headers.date).to.exist(); expect(res.headers.connection).to.exist(); expect(res.headers['transfer-encoding']).to.not.exist(); @@ -220,7 +223,7 @@ describe('inject()', () => { } }; - Shot.inject(dispatch, { url: url }, (res) => { + Shot.inject(dispatch, { url }, (res) => { expect(res.headers.date).to.exist(); expect(res.headers.connection).to.exist();