Skip to content
New issue

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

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: preserve default headers with custom headers #452

Merged
merged 8 commits into from
Dec 14, 2020
Merged

fix: preserve default headers with custom headers #452

merged 8 commits into from
Dec 14, 2020

Conversation

pi0
Copy link
Member

@pi0 pi0 commented Dec 10, 2020

There is a breaking change with axios axios/axios@v0.19.2...v0.20.0 that when passing headers config when calling axios, it discards defaults.headers.common (used for both config and setHeader utility.

resolves #411

Update: Axios regression found by @1ed regarding defaults overriding: axios/axios#2844 <3


Test flow for #411:

  • /api/cookie endpoint that simply returns value of mycookie header if set
  • Make a random string in client-side and set cookie "mycookie"
  • Make SSR request
    • SSR request makes a call to /api/cookie in asyncData using $axios to check what headers are passed to API when using axios in server side
  • Value is checked against initial random one (and passing)

Locally trying:

pi0 and others added 2 commits December 14, 2020 11:04
@pi0 pi0 changed the title fix: try to fix #411 fix: preserve default headers with custom headers Dec 14, 2020
@codecov
Copy link

codecov bot commented Dec 14, 2020

Codecov Report

Merging #452 (97c477f) into master (bec998c) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #452   +/-   ##
=======================================
  Coverage   95.55%   95.55%           
=======================================
  Files           1        1           
  Lines          45       45           
  Branches       25       25           
=======================================
  Hits           43       43           
  Misses          2        2           

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 bec998c...97c477f. Read the comment docs.

@pi0 pi0 marked this pull request as ready for review December 14, 2020 11:54
@pi0 pi0 merged commit 55f994f into master Dec 14, 2020
@pi0 pi0 deleted the fix/411 branch December 14, 2020 11:58
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Broken server side request with cookies in 5.12.2
2 participants