ardatan / feTS

🗹 TypeScript HTTP Framework focusing on e2e type-safety, easy setup, performance & great developer experience
https://the-guild.dev/openapi/fets
MIT License
644 stars 29 forks source link

globalParams are not applied to requests. #2096

Open selcuk-sahin opened 6 days ago

selcuk-sahin commented 6 days ago

Describe the bug

Setting globalParams has no effect, parameters are not added to request

To Reproduce Steps to reproduce the behavior:

export const myClient = () => createClient<NormalizeOAS<typeof spec>>({
  endpoint: '<url>',
  globalParams: { credentials: 'include' }, // not applied
})

Expected behavior

I expected parameters would have been added

Environment:

Additional context As a workaround, I added a custom plugin, which worked.

const credentialsSetter: ClientPlugin = {
  onRequestInit({ requestInit }) {
    requestInit.credentials = 'include'
  },
}

export const myClient = () => createClient<NormalizeOAS<typeof spec>>({
  plugins: [credentialsSetter],
  endpoint: '<url>',
})