Replies: 2 comments 4 replies
-
Can't you use the method described in the second snippet in the docs? services.AddRestEaseClient<ISomeApi>("https://api.example.com", new()
{
RestClientConfigurer = client =>
{
client.RequestPathParamSerializer = new StringEnumRequestPathParamSerializer(),
// Other serializers, settings, etc?
},
}); |
Beta Was this translation helpful? Give feedback.
2 replies
-
Turns out, coming up with a nice API for this, which doesn't break backwards compat, is irritating. I'll have to have a think about how best to do this... |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The HTTPClientFactory extension is a nice way to add restease clients to the DI process, but at the moment it is not possible to inject the settings or alternative serializers. I've been playing around with the source and it is not that difficult to add an overload that takes a delegate with a service provider without changing anything substantial.
That is besides one thing, the requestModifier. I haven't found a clean way yet to deal with nulls for that, as the AddHttpMessageHandler call on the HTTPClientBuilder does not check for nulls when taking a delegate and in the current extension structure that would be the only place to resolve wat is passed in.
I have managed to work around almost all the limitations be using ConfigureHttpClient and ConfigurePrimaryHttpMessageHandler, But I still need the RestClientConfigurer method to set the serializer/deserializer and QueryStringBuilder, and it would be nicer to just have one nice configuration section.
Is this something that is planned? Or something you would accept a pullrequest/proposal for?
Beta Was this translation helpful? Give feedback.
All reactions