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: Include final URL in redirect history. #994

Merged
merged 1 commit into from
Aug 21, 2021
Merged

fix: Include final URL in redirect history. #994

merged 1 commit into from
Aug 21, 2021

Conversation

ShogunPanda
Copy link
Contributor

In the current implementation, a URL is added to context.history only if in the response there is a redirect to follow.
Unfortunately, this results in the final URL of the redirects chain to never be present in the history and apparently there are no other ways to get such URL.

This PR fixes this problem by appending each URL visited. In case of no redirections, the context.history will contain just one element.

Hope this helps!

@codecov-commenter
Copy link

codecov-commenter commented Aug 21, 2021

Codecov Report

Merging #994 (f486db7) into main (31ee8f6) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #994   +/-   ##
=======================================
  Coverage   94.02%   94.03%           
=======================================
  Files          37       37           
  Lines        3583     3587    +4     
=======================================
+ Hits         3369     3373    +4     
  Misses        214      214           
Impacted Files Coverage Δ
lib/handler/redirect.js 95.06% <100.00%> (+0.06%) ⬆️
lib/fetch/request.js 81.70% <0.00%> (ø)
lib/fetch/body.js 99.15% <0.00%> (+<0.01%) ⬆️
lib/fetch/util.js 85.71% <0.00%> (+0.46%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 31ee8f6...f486db7. Read the comment docs.

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@ronag ronag merged commit ffc6341 into nodejs:main Aug 21, 2021
@ShogunPanda ShogunPanda deleted the full-redirect-history branch August 21, 2021 09:56
KhafraDev pushed a commit to KhafraDev/undici that referenced this pull request Jun 23, 2022
crysmags pushed a commit to crysmags/undici that referenced this pull request Feb 27, 2024
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.

4 participants