How to access the service interface to set its property? #240
-
I have an API interface with a property that acts as an HTTP header value source: and register it with the services.AddRestEaseClient("base address"). Q: when calling the AddRestEaseClient how to access the IApi instance (which is generated with RestEase.For under the hood) to set its AuthHeader property value? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
See the 2nd example under the Using HttpClientFactory section of the readme... |
Beta Was this translation helpful? Give feedback.
-
Good question, there's no way currently. It's not too hard to add technically, but the overloads are becoming a bit of a mess and it's hard to add extra parameters in a way which doesn't break backwards compat. |
Beta Was this translation helpful? Give feedback.
-
Currently, I've fixed this problem by adding the header explicitly in the standard ConfigureHttpClient() but smashes the API interface setup across the application (API methods are in the IApi interface while its auth headers are outside of it). |
Beta Was this translation helpful? Give feedback.
-
Released as 1.6.0 |
Beta Was this translation helpful? Give feedback.
Released as 1.6.0