openapi-typescript icon indicating copy to clipboard operation
openapi-typescript copied to clipboard

Change defaults in fetch options

Open boompikachu opened this issue 9 months ago • 1 comments

Description

Is there a way to change the default value when creating fetch client especially the baseUrl? const client = createFetchClient({ baseUrl: 'some-url' })

for example, in axios, we can just do axiosInstance.defaults.baseURL = 'new-base-url'

Proposal

maybe

const client = createFetchClient({ baseUrl: 'some-url' })
client.defaults.baseUrl = "new-base-url"

Extra

boompikachu avatar Feb 18 '25 04:02 boompikachu

one way I found is to recreate the entire fetch client with a different baseUrl

boompikachu avatar Feb 18 '25 04:02 boompikachu