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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect response object being emitted on redirect #1761

Merged
merged 1 commit into from
Jan 25, 2023

Conversation

wilsonjackson
Copy link
Contributor

@wilsonjackson wilsonjackson commented Jan 24, 2023

Changes the argument emitted with the redirect event to a Supertest Response object instead of an unwrapped IncomingMessage.

Closes #1760

Checklist

  • I have ensured my pull request is not behind the main or master branch of the original repository.
  • I have rebased all commits where necessary so that reviewing this pull request can be done without having to merge it first.
  • I have written a commit message that passes commitlint linting.
  • I have ensured that my code changes pass linting tests.
  • I have ensured that my code changes pass unit tests.
  • I have described my pull request and the reasons for code changes along with context if necessary.

@wilsonjackson wilsonjackson changed the title Add failing test for issue #1760 Fix incorrect response object being emitted on redirect Jan 24, 2023
@@ -551,12 +551,13 @@ Request.prototype._redirect = function (res) {
_initHeaders(this);

// redirect
this.res = res;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@titanism This is the main change I'm not super certain about. Without doing this, a couple of the tests around .pipe() fail because there's no this.res on the response. I don't know if this assignment has the potential to screw anything else up.

@titanism
Copy link
Collaborator

v8.0.9 released to npm and GitHub releases

https://github.com/ladjs/superagent/releases/tag/v8.0.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[fix] Following redirects discards set cookies without explicit domain
2 participants