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

Set baseUrl per request

Open RobinClowers opened this issue 1 year ago • 2 comments

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 avatar Apr 26 '24 22:04 RobinClowers

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.

Gruak avatar Jun 24 '24 14:06 Gruak

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

drwpow avatar Jun 24 '24 14:06 drwpow

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

RobinClowers avatar Aug 23 '24 22:08 RobinClowers

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

nikrooz avatar Sep 11 '24 11:09 nikrooz

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 avatar Sep 12 '24 13:09 drwpow