-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Labels
rfcRequest for commentsRequest for comments
Description
RFC for v109.
New features
Done, awaiting feedback
IRestClientinterface withOptions,Serializers,ExecuteAsync, andDownloadStreamAsync- Target frameworks: .NET 6, .NET 9, .NET Framework 4.7.1, .NET Standard 2.0
- Using the Configuration pattern for options, serializers, etc
Planned
RestClientFactoryimplementation. It is unclear if we should useIHttpClientFactoryor an internal factory like it's done by Flurl. Using both might work too.
Breaking changes
- Serializers configuration using a delegate passed to the constructor.
UseXXXmethods to configure serializers moved to theSerializerConfig Authenticator,Encode,EncodeQuerymoved toRestClientOptionsOptionsexposed by the client changed the type toIRestClientOptionswhere most of the properties are get-only. Also, properties that configureHttpClientorHttpMessageHandlerare not included toIRestClientOptions.
Motivation
The client instance should not be as mutable as it is today. The current API allows making configuration changes at runtime, which can produce undesired side-effects when the client instance is used in multi-threaded scenarios.
Example serializer configuration
Before:
var client = new RestClient(url);
client.UseNewtonsoftJson();After:
var client = new RestClient(url, configureSerializers: cfg => cfg.UseNewtonsoftJson());Metadata
Metadata
Assignees
Labels
rfcRequest for commentsRequest for comments