Skip to content

Commit

Permalink
Release 1.2.5 of the project
Browse files Browse the repository at this point in the history
This incorporates may bug fixes and features submitted by many folks.
I really appreciate the support, and I promise from now on, I will
incorporate the fixes quicker in order to keep a better Git history.
  • Loading branch information
howardabrams committed Mar 5, 2015
1 parent 5619386 commit f8f1cef
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,13 @@ Most releases fix bugs with our mocks or add features similar to the
actual `Request` and `Response` objects offered by Node.js and extended
by Express.

* v 1.2.5

* Add `path` to request similar to how express does `req.path`
* Emit send and end events for json response too
* res.set() works like Express when passed an object #33
* Set mockResponse.statusCode default to 200, instead of -1


License
---
Expand Down
8 changes: 6 additions & 2 deletions lib/mockResponse.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,12 @@ function createResponse(options) {
*/
mockResponse.set = mockResponse.header = function header(field, val) {
if (arguments.length === 2) {
if (Array.isArray(val)) val = val.map(String);
else val = String(val);
if (Array.isArray(val)) {
val = val.map(String);
}
else {
val = String(val);
}
mockResponse.setHeader(field, val);
} else {
for (var key in field) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"author": "Howard Abrams <howard.abrams@gmail.com> (http://github.com/howardabrams)",
"name": "node-mocks-http",
"description": "Mock 'http' objects for testing Express routing functions",
"version": "1.2.4",
"version": "1.2.5",
"homepage": "http://github.com/howardabrams/node-mocks-http",
"license" : "MIT",
"keywords": [
Expand Down

0 comments on commit f8f1cef

Please sign in to comment.