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

Change defaults in fetch options #2159

Open
1 task
boompikachu opened this issue Feb 18, 2025 · 1 comment
Open
1 task

Change defaults in fetch options #2159

boompikachu opened this issue Feb 18, 2025 · 1 comment
Labels
enhancement New feature or request openapi-fetch Relevant to the openapi-fetch library

Comments

@boompikachu
Copy link

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 boompikachu added enhancement New feature or request openapi-fetch Relevant to the openapi-fetch library labels Feb 18, 2025
@boompikachu
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request openapi-fetch Relevant to the openapi-fetch library
Projects
None yet
Development

No branches or pull requests

1 participant