Comments (8)
@eugef I noticed that the response.end() callback you find in the official Node.js docs
https://nodejs.org/docs/latest-v12.x/api/http.html#http_response_end_data_encoding_callback
is not triggered. Is it possible to have the mock response object mimick the native response on this matter?
from node-mocks-http.
Hi @GiordanoArman PR is always welcome.
Meanwhile you can manually trigger response.end()
callback in the tests this way:
import httpMocks from 'node-mocks-http';
const req = httpMocks.createRequest();
const res = httpMocks.createResponse();
const next = () => {};
someMiddleware(req, res, next);
res.end();
from node-mocks-http.
@eugef ok, thanks, would you rather have this fix on a fork of the 1.x branch or master branch?
from node-mocks-http.
Master branch
from node-mocks-http.
ok, great :) will this fix be released in a 1.x version or when you release version 2?
from node-mocks-http.
I assume this feature won't introduce a breaking change, so it would be possible to release as a minor version.
from node-mocks-http.
ok, do you perhaps need to add me as collaborator somehow in order for me to push the changes? I'm stuck with auth errors, whether I use personal tokens or SSH keys... been a while since last time I used GitHub via command line lol
from node-mocks-http.
Hi @GiordanoArman, please fork the repo and do all the changes there, Then you can create a PR https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork
from node-mocks-http.
Related Issues (20)
- Response does not throw an error when sending twice HOT 11
- @types/express 3.17.15 -> Request/Response mismatch HOT 5
- Importing produces ESlint warning `import/named` HOT 7
- Timeouts when using with formidable HOT 1
- Tests started to fail when using node 16 to run then and works when use node 14 HOT 1
- Provide decorator for stream consumer through pipe HOT 2
- Any plans to add async iterator support to IncomingMessage? HOT 5
- Let mock request extend stream.Readable or even http.IncomingMessage HOT 4
- `node-mocks-http` doesn't work with NextJS requests HOT 2
- subdomains property in the request not supported HOT 1
- Unexpected end of JSON input with async express router HOT 4
- What happens if you have a database call in your handler? HOT 2
- @types/express should be a non-dev dependency HOT 1
- Deprecate `lib/express` HOT 2
- 'links' function not defined HOT 3
- Not compatible with the Next.js "app" router HOT 2
- Question: How to mock an request error? HOT 2
- how to create error response? HOT 4
- Query string parsing is potentially misleading HOT 4
- The `sendFile` property is missing HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-mocks-http.