[Pkg-javascript-commits] [node-mocks-http] 52/296: Adding support for res.json(data, statusCode)
Thorsten Alteholz
alteholz at moszumanska.debian.org
Mon Feb 8 18:13:20 UTC 2016
This is an automated email from the git hooks/post-receive script.
alteholz pushed a commit to branch master
in repository node-mocks-http.
commit c23edef9628c1c9db4431ef74646f324844c0032
Author: Ryan Knell <ryan.knell at gmail.com>
Date: Wed Oct 15 15:40:59 2014 +1000
Adding support for res.json(data, statusCode)
---
lib/mockResponse.js | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/lib/mockResponse.js b/lib/mockResponse.js
index d1ba0b0..43e661f 100644
--- a/lib/mockResponse.js
+++ b/lib/mockResponse.js
@@ -199,9 +199,13 @@ function createResponse(options) {
break;
case 2:
-
- mockResponse.statusCode = a;
- _data += JSON.stringify(b);
+ if(typeof a === 'number'){
+ this.statusCode = a;
+ _data += JSON.stringify(b);
+ } else {
+ this.statusCode = b;
+ _data += JSON.stringify(a);
+ }
break;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-mocks-http.git
More information about the Pkg-javascript-commits
mailing list