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

feat(axios): handle http redirect #221

Merged
merged 1 commit into from
Jan 8, 2024
Merged

Conversation

idranme
Copy link
Contributor

@idranme idranme commented Jan 6, 2024

此 PR 旨在使 Quester.file 返回的 filename 基于最终访问的 URL

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (6390012) 86.08% compared to head (eae889d) 86.08%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #221   +/-   ##
=======================================
  Coverage   86.08%   86.08%           
=======================================
  Files           1        1           
  Lines         503      503           
  Branches      111      111           
=======================================
  Hits          433      433           
  Misses         70       70           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@idranme idranme changed the title feat: handle http redirects feat(axios): handle http redirects Jan 6, 2024
@idranme idranme changed the title feat(axios): handle http redirects feat(axios): handle http redirect Jan 6, 2024
@idranme
Copy link
Contributor Author

idranme commented Jan 6, 2024

fetch 检测重定向

fetch('something')
  .then(response => {
    if (response.redirected) {
      console.log('Redirected URL:', response.url);
    }
  })

response.url: https://developer.mozilla.org/zh-CN/docs/Web/API/Response/url
response.redirected: https://developer.mozilla.org/zh-CN/docs/Web/API/Response/redirected

如果运用到此 PR,咱们无需判断 response.redirected,因为 ”url 属性值为经过重定向后最终获得的 URL 地址“。

@shigma shigma merged commit 9aac05e into satorijs:master Jan 8, 2024
4 checks passed
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.

3 participants