Shopify / shopify-app-bridge

https://shopify.dev/docs/api/app-bridge
88 stars 9 forks source link

authenticatedFetch is overriding the headers of the original call #43

Closed yochail closed 1 year ago

yochail commented 3 years ago

Describe the bug

while trying to send a custom header in options: authenticatedFetch(app,fetch)(uri, options: { headers:{ 'Content-Type':'application/json' } }, body:body ); the headers will reset to "content-type: text/plain", as the auth header will replace any previous header and will set everything to default

To Reproduce

Steps to reproduce the behavior:

  1. set the custom header on options
  2. send authenticatedFetch with that options object
  3. check to call in dev tools to see if the custom header persisted

Expected behavior

the method should add the authentication header in addition to existing headers

Contextual information

missing 'Content-Type':'application/json' on the call will cause the body to not being parsed by middleware like 'koa-bodyparser'

Packages and versions

List the relevant packages you’re using, and their versions. For example: server:

client:

Additional context

using Node package

charlesdobson commented 1 year ago

This was fixed since v2.0.12.