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: override header value when invoke #1425

Merged
merged 6 commits into from
Nov 7, 2024

Conversation

quando1910
Copy link
Contributor

@quando1910 quando1910 commented Nov 7, 2024

Description

  • Got the unexpected behavior when try to override the default headers with adminApiClient. because of passing wrong params position into defu function
Screen Shot 2024-11-07 at 4 17 02 PM

Reproduce

  • Set defaut headers: adminApiClient.defaultHeaders.apply({ "sw-context-token": "xxxxx" });

  • override when invoke:

 const response = await adminApiClient.invoke("path", {
   headers: {
      "sw-context-token": "yyyyy"
   }
});
  • Request was called with sw-context-token = xxxxx. The expectation should be called with sw-context-token = yyyyy

Type of change

Bug fix

Copy link

vercel bot commented Nov 7, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
frontends-demo 🔄 Building (Inspect) Visit Preview Nov 7, 2024 10:46am
shopware-frontends-docs ✅ Ready (Inspect) Visit Preview Nov 7, 2024 10:46am

Copy link
Collaborator

@patzick patzick left a comment

Choose a reason for hiding this comment

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

NIce catch!
Please add test case for that in createAdminApiClient.test.ts and a patch changelog entry (instruction: https://github.com/shopware/frontends/blob/main/CONTRIBUTION.md#changelog-preparation )

Copy link

pkg-pr-new bot commented Nov 7, 2024

Open in Stackblitz

@shopware/api-client

pnpm add https://pkg.pr.new/shopware/frontends/@shopware/api-client@1425

@shopware/api-gen

pnpm add https://pkg.pr.new/shopware/frontends/@shopware/api-gen@1425

@shopware-pwa/cms-base

pnpm add https://pkg.pr.new/shopware/frontends/@shopware-pwa/cms-base@1425

@shopware-pwa/composables-next

pnpm add https://pkg.pr.new/shopware/frontends/@shopware-pwa/composables-next@1425

@shopware-pwa/nuxt3-module

pnpm add https://pkg.pr.new/shopware/frontends/@shopware-pwa/nuxt3-module@1425

@shopware-pwa/helpers-next

pnpm add https://pkg.pr.new/shopware/frontends/@shopware-pwa/helpers-next@1425

commit: 8174cdb

Copy link

codspeed-hq bot commented Nov 7, 2024

CodSpeed Performance Report

Merging #1425 will not alter performance

Comparing fix/overide-header-value-when-invoke (8174cdb) with main (b550cef)

Summary

✅ 9 untouched benchmarks

Copy link
Collaborator

@patzick patzick left a comment

Choose a reason for hiding this comment

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

Thanks @quando1910 !

@patzick patzick merged commit 8df7651 into main Nov 7, 2024
12 of 13 checks passed
@patzick patzick deleted the fix/overide-header-value-when-invoke branch November 7, 2024 10:58
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.

2 participants