Code Monkey home page Code Monkey logo

Comments (8)

GiordanoArman avatar GiordanoArman commented on June 30, 2024

@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.

eugef avatar eugef commented on June 30, 2024

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.

GiordanoArman avatar GiordanoArman commented on June 30, 2024

@eugef ok, thanks, would you rather have this fix on a fork of the 1.x branch or master branch?

from node-mocks-http.

eugef avatar eugef commented on June 30, 2024

Master branch

from node-mocks-http.

GiordanoArman avatar GiordanoArman commented on June 30, 2024

ok, great :) will this fix be released in a 1.x version or when you release version 2?

from node-mocks-http.

eugef avatar eugef commented on June 30, 2024

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.

GiordanoArman avatar GiordanoArman commented on June 30, 2024

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.

eugef avatar eugef commented on June 30, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.