- Fix: writeHead() sets headersSent Issue #313.
- Allowing @types/express v5 Issue #309.
- Add appendHeader to MockResponse Issue #306.
- Add Fetch API types as accepted mock parameters Issue #291.
- Allowing @types/node v22 Issue #305.
- Add to write() and end() support of TypedArray Issue #300.
- Fix: return empty string when send() was called with undefined Issue #298.
- Move express and node types to prod deps Issue #290.
- Fix nodejs typing Issue #281.
- Add testing capability in TypeScript Issue #282.
- Add Request async iterator Issue #278.
- 📦️ Upgrade @types/express Issue #267.
- setHeader should return this Issue #268.
- Fix lint issue
- Make it easier to create mocks for the node http library Issue #259.
- mockResponse.end(): added callback triggering once end() logic has run Issue #248.
- Fix request.ip and add request.ips Issue #244.
- Add response.attachment() from express Issue #246.
- Add request.getHeader() alias for request.header() Issue #241.
- Fix support for req.hostname Issue #231.
- Add support for req.hostname Issue #224.
- Allow to chain writeHead() Issue #229.
- Implement response.getHeaderNames() and response.hasHeader() Issue #222.
- Remove calls to deprecated Buffer constructors Issue #221.
- Run tests for Node 10, 12 and 14. Drop support for Node 6 and 8 Issue #218.
- Implement response.getHeaders() Issue #217.
- Add req.subdomains Issue #213.
- Add socket option to mockRequest Issue #209.
- Fix index.d.ts Issue #205.
- Added support for response.writableEnded and response.writableFinished Issue #205.
- Enable res.render() callback argument Issue #197.
- Added types for IncomingHeaders Issue #192.
- Enabled method chaining Issue #191.
- Added accepts language Issue #188.
- Fix for Issue #182.
- Updated the dependency tree with newer versions of
eslint
.
- Added
_getJSONData
function with data sent to the user as JSON. #181
- Added
.range()
on a mocked request mimicking the same function on Express' request. #175
- Revert Turn mock request into a stream #174
- Fix security issues reported by npm audit
- Turn mock request into a stream #169
- Added missing typings for "locals" & create a helper method to get locals #170
- Make header names case-insensitive in response #172
- Throw an error object instead of a string #173
- Better typings, including the following (see PR #158 for details):
- request object for a controller fn which is typed as extension of
express.Request
- same for
Response
- custom properties appended to request object
- fixed missing
_getRenderView
method onResponse
- request object for a controller fn which is typed as extension of
Note: As of this release, we are officially supporting:
- 6.13
- 8.9
- 9.6
- Set an expiration date to a cookie when deleting it #155
- No
finish
event,end
event called when it shouldn't be. #112 - Add support for append on MockResponse #143
- Add locals object to response #135
Special shoutout to Eugene Fidelin for joining the team and helping out so much.
- Upgrade Fresh dependency to 0.5.2 due to a Security advisory. PR #147
- Add the baseUrl property to the request object. PR #150
- Query type definition now more flexible PR #146
- Incorporated a trimmed down published NPM artifact PR #141
- Moved @types/express to dev-dependencies. PR #136
- Fix for Issue #130 for method chaining for
cookie()
andclearCookie()
- Fix for Issue #131 for adding
finished
to the response
- Dropping support for Node's "0" version, but will continue to support v4.
- Verifying our builds with v6 (latest stable) as well as current work (v7)
- Removing dependency on lodash and other bug fixes
- Call
write
method from json method ofresponseMock
PR #98
- Add
.format
to themockResponse
object PR #94 - Add
.location
to themockResponse
object PR #96 - Add API method,
createMocks
to create both mocks with correct references
- Add case insensitive response headers #85
- Fix behavior of
mockResponse.writeHead
#92 - Add support for statusMessage #84
- Fix issue with
req.param
not returning when false #82 - Other bug fixes
- Add support for the
.vary()
response method
Documentation changes, a new feature, and better behaviors, including:
- Added
jsonp
method that takes a status code and a payload, see PR #79 - Now able to attach non-standard properties to the mock request object. PR #74
- param now takes a default value, see PR #76
- Emit
end
when redirecting, see PR #77 - Documentation changes, see PR #64, PR #75, PR #78
Bug fix release, including the following:
- Adds a
.header
and.get
method to the request.
- Adds a
.header
,.set
, and.get
method to the response.
- Adds the MIT license
-
Merged changes by invernizzie: to address #11
-
Merged changes by ericchaves:
I extended your library a little but so it could also handle some structured responses. By doing so res.send now evaluate the data passed and search for either a statusCode or httpCode to be used, and also for a body to send as _data.
It still working as expected (at least tests passed) for regular HTTP responses.
Although I did it with node-restify in mind, it should work well for all other libs.
- Adds a
.json()
method to the response. (Thanks, diachedelic) - Cleaned up all source files so ./run-tests passes.
- Cleaned up jshint issues.
- Adds support for response redirect and render
- Adds support for response cookies
- Adds support for request headers
- Fix wrong function name of set cookies
- Adds support for request cookies
- Adds support for request files
- Fixed a bug where
response.send()
can take two parameters, the status code and the data to send.
- Adds a
request.session
that can be set during construction (or via calling the_setSessionVariable()
method, and read as an object.
- Adds a
request.query
that can be set during construction and read as an object.
- Code refactoring of the
Response
mock.
- Initial code banged out one late night...