node-mocks-http
node-mocks-http copied to clipboard
Mock 'http' objects for testing Express routing functions
Adds Fetch API's `Request` and `Response` objects to accepted generic types, allowing for using objects that extend this, e.g. [NextJS](https://nextjs.org/docs/app/api-reference/functions/next-request) App Router. fixes #233
As mentioned before in issues #88 and #245 (which were both closed without resolving!) the `sendFile` method is missing from this implementation. The TypeScript typedefs say it is there, but...
I've a requestResponseLogger middleware which I'm trying to test few uses 1) when request is sent, it should log req info (call logger.log) 2) when response is success, it should...
From the README: > Mock 'http' objects for testing [Express](https://expressjs.com/)... Query string parsing was added in https://github.com/eugef/node-mocks-http/pull/30, but the results are potentially misleading. `node-mocks-http` uses node's built-in `querystring` to parse...
Hi, I have a test using the Express Response.links function. When I use node-mocks-http it gives an error stating that the function 'links' is not defined. Is it possible you...
It seems that this package is not compatible with Next's newer ["app" router](https://nextjs.org/docs/app/building-your-application/routing#the-app-router). The older "page" router works fine because its [NextApiRequest](https://github.com/vercel/next.js/blob/canary/packages/next/src/shared/lib/utils.ts#L202) extends IncomingMessage as your package requires. However, the...
This code was not updated for a long time and probably has very low usage - It duplicates functionality from `lib/mockRequests` - It is not documented
Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3. Commits 74b2db2 3.0.3 88f1429 update eslint. lint, fix unit tests. 415d660 Snyk js braces 6838727 (#40) 190510f fix tests, skip 1 test in test/braces.expand...
I have some code which both writes to the response directly (using `res.write`) and also pipes some data to the response (using `otherStream.pipe(res)`. The problem is that for some reason...
More information here: https://github.com/e18e/ecosystem-issues/issues/160