Skip to content

Set baseUrl per request #1633

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

Closed
1 task done
RobinClowers opened this issue Apr 26, 2024 · 5 comments
Closed
1 task done

Set baseUrl per request #1633

RobinClowers opened this issue Apr 26, 2024 · 5 comments
Labels
enhancement New feature or request good first issue Straightforward problem, solvable for first-time contributors without deep knowledge of the project openapi-fetch Relevant to the openapi-fetch library PRs welcome PRs are welcome to solve this issue!

Comments

@RobinClowers
Copy link

Description

My app has an API that is per tenant, so I end up having to create a client every time I need to call the API, since the baseUrl varies.

Proposal

Ideally it would be as simple as:

client.GET("/api/region", {
  baseUrl: "https://api.example.com",
})

Checklist

@RobinClowers RobinClowers added enhancement New feature or request PRs welcome PRs are welcome to solve this issue! openapi-fetch Relevant to the openapi-fetch library labels Apr 26, 2024
@Gruak
Copy link
Contributor

Gruak commented Jun 24, 2024

I also need this for the same reason.
It would also be nice to be able to set a baseUrl getter per client that would read the baseUrl from an external store on request or be able to set the baseUrl through a middleware.

@drwpow
Copy link
Contributor

drwpow commented Jun 24, 2024

This is an easy add and wouldn’t disrupt anything. Would welcome a PR for this 🙂

@drwpow drwpow added the good first issue Straightforward problem, solvable for first-time contributors without deep knowledge of the project label Jun 24, 2024
@RobinClowers
Copy link
Author

@Gruak I forgot about this, thanks for making that change! @drwpow can we get a release with the change soon?

@nikrooz
Copy link

nikrooz commented Sep 11, 2024

Thank you for adding this feature. I was wondering if there are any plans to release it soon.

@drwpow
Copy link
Contributor

drwpow commented Sep 12, 2024

Thank you for adding this feature. I was wondering if there are any plans to release it soon.

Please see the CHANGELOG. This has already been released!

@drwpow drwpow closed this as completed Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Straightforward problem, solvable for first-time contributors without deep knowledge of the project openapi-fetch Relevant to the openapi-fetch library PRs welcome PRs are welcome to solve this issue!
Projects
None yet
Development

No branches or pull requests

4 participants