Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add a check if the res is destroyed before sending response #10106

Merged
merged 5 commits into from Aug 16, 2022

Commits on Aug 12, 2022

  1. fix: add a check if the res is destroyed before sending response

    In the case of using `curl` or a similar tool on the command line,
    or if the client decides to end the request for a streamed file early
    without the check we would end up causing a server crash. Now, we will
    just not send the response as the client has already decided how to
    move on.
    
    fix: nestjs#10105
    jmcdo29 committed Aug 12, 2022
    Configuration menu
    Copy the full SHA
    3fb6771 View commit details
    Browse the repository at this point in the history
  2. test: add test for res.destroyed handler

    I had to use node's `http` module for this because
    I could not get `supertest`s `abort` method to
    work properly. With the raw `http` module I was able
    to use `req.destroy()` to cancel the request early.
    We now see the error from a premature closure, but are
    still able to make extra requests afterwards
    jmcdo29 committed Aug 12, 2022
    Configuration menu
    Copy the full SHA
    e82bdd4 View commit details
    Browse the repository at this point in the history
  3. test: split abrupt stop test into a utils file

    As we make use of the `http` module instead of axios or supertest
    we have tomake use of some rather low level code. Using this utils
    file we can have clearer names of what is happening in each request
    to make it easier to follow what's happening. I've also added in some
    comments about why each part is the way it is for clarity.
    jmcdo29 committed Aug 12, 2022
    Configuration menu
    Copy the full SHA
    e66423b View commit details
    Browse the repository at this point in the history

Commits on Aug 14, 2022

  1. Configuration menu
    Copy the full SHA
    78fc6be View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    6d0595b View commit details
    Browse the repository at this point in the history