Skip to content

Fix incorrect response object being emitted on redirect#1761

Merged
titanism merged 1 commit into
forwardemail:masterfrom
Leafly-com:fix/follow-redirect-cookies
Jan 25, 2023
Merged

Fix incorrect response object being emitted on redirect#1761
titanism merged 1 commit into
forwardemail:masterfrom
Leafly-com:fix/follow-redirect-cookies

Conversation

@wilsonjackson

@wilsonjackson wilsonjackson commented Jan 24, 2023

Copy link
Copy Markdown
Contributor

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 force-pushed the fix/follow-redirect-cookies branch from dbec926 to 8935ad9 Compare January 24, 2023 02:55
@wilsonjackson wilsonjackson changed the title Add failing test for issue #1760 Fix incorrect response object being emitted on redirect Jan 24, 2023
@wilsonjackson wilsonjackson force-pushed the fix/follow-redirect-cookies branch from 8935ad9 to e2538f3 Compare January 24, 2023 03:04
Comment thread src/node/index.js
_initHeaders(this);

// redirect
this.res = res;

Copy link
Copy Markdown
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 titanism merged commit cd094f5 into forwardemail:master Jan 25, 2023
@titanism

Copy link
Copy Markdown
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