Closed seriouslag closed 4 months ago
Hey @seriouslag, do you have a specific use case in mind?
Some requests require specific headers or cookies. Would be nice to be able to set them at the method level.
Why can't/don't want you to set them using interceptors?
In the interceptor I would have to check for a specific url and method.
Passing the override configuration in the method, the consumer would not need to check anything. Cleaner API, easy to understand.
Interceptors should be used when something applies to every API call not a specific call in my opinion.
Hey @seriouslag, do you have a specific use case in mind?
Hi!
For example, it is not possible to use generated code on SSR because all requests use global configuration. Being able to pass the config to a specific request could solve this problem. The ability to create OpenAPI instances could also solve this problem
Hi!
I have a use case for this. I'm running a plugin for OpenShift that needs to be able to connect to all the pods that are deployed and issue requests to all the API servers to get some data to display.
Having some support to dynamically change the endpoint would be great for this!
@lavocatt We should be able to support this with the upcoming clients
@ArtemAstakhov @lavocatt I don't know if you're using Fetch API, but if yes, this is available in the new Fetch API client. You can play with the demo and see what you can pass to each request. Would love your feedback!
is that available in the Angular client?
Hey @cyrilfr, this is available in the new, standalone clients (Fetch API and Axios). If you can make Angular work with either of them then the answer would be yes, but I did not explicitly try it yet https://github.com/hey-api/openapi-ts/issues/667#issuecomment-2233629443
OK, I'm going to use the fetch client for now, but it's not injectable in the Angular way. I'll add a script that will remove the static
keyword and add Angular's @Injectable()
annotation to all generated services. It's pretty messy but it's the only way to have up-to-date support right now.
Description
It would be nice to pass the OpenAPI config per request if needed. This can be helpful if individual requests need specific configurations.