@@ -39,15 +39,24 @@ public partial class RestClient : IRestClient {
39
39
40
40
HttpClient HttpClient { get ; }
41
41
42
- public IRestClientOptions Options { get ; }
43
- public RestSerializers Serializers { get ; }
42
+ /// <inheritdoc />>
43
+ public IRestClientOptions Options { get ; }
44
+
45
+ /// <inheritdoc />>
46
+ public RestSerializers Serializers { get ; }
44
47
45
48
[ Obsolete ( "Use RestClientOptions.Authenticator instead" ) ]
46
49
public IAuthenticator ? Authenticator {
47
50
get => Options . Authenticator ;
48
51
set => Options . Authenticator = value ;
49
52
}
50
53
54
+ /// <summary>
55
+ /// Creates an instance of RestClient using the provided <see cref="RestClientOptions"/>
56
+ /// </summary>
57
+ /// <param name="options">Client options</param>
58
+ /// <param name="configureDefaultHeaders">Delegate to add default headers to the wrapped HttpClient instance</param>
59
+ /// <param name="configureSerialization">Delegate to configure serialization</param>
51
60
public RestClient (
52
61
RestClientOptions options ,
53
62
ConfigureHeaders ? configureDefaultHeaders = null ,
@@ -77,28 +86,49 @@ static RestClientOptions ConfigureOptions(RestClientOptions options, ConfigureRe
77
86
/// Creates an instance of RestClient using the default <see cref="RestClientOptions"/>
78
87
/// </summary>
79
88
/// <param name="configureRestClient">Delegate to configure the client options</param>
89
+ /// <param name="configureDefaultHeaders">Delegate to add default headers to the wrapped HttpClient instance</param>
80
90
/// <param name="configureSerialization">Delegate to configure serialization</param>
81
- public RestClient ( ConfigureRestClient ? configureRestClient = null , ConfigureSerialization ? configureSerialization = null )
82
- : this ( ConfigureOptions ( new RestClientOptions ( ) , configureRestClient ) , configureSerialization : configureSerialization ) { }
91
+ public RestClient (
92
+ ConfigureRestClient ? configureRestClient = null ,
93
+ ConfigureHeaders ? configureDefaultHeaders = null ,
94
+ ConfigureSerialization ? configureSerialization = null
95
+ )
96
+ : this ( ConfigureOptions ( new RestClientOptions ( ) , configureRestClient ) , configureDefaultHeaders , configureSerialization ) { }
83
97
84
98
/// <inheritdoc />
85
99
/// <summary>
86
100
/// Creates an instance of RestClient using a specific BaseUrl for requests made by this client instance
87
101
/// </summary>
88
102
/// <param name="baseUrl">Base URI for the new client</param>
89
103
/// <param name="configureRestClient">Delegate to configure the client options</param>
104
+ /// <param name="configureDefaultHeaders">Delegate to add default headers to the wrapped HttpClient instance</param>
90
105
/// <param name="configureSerialization">Delegate to configure serialization</param>
91
- public RestClient ( Uri baseUrl , ConfigureRestClient ? configureRestClient = null , ConfigureSerialization ? configureSerialization = null )
92
- : this ( ConfigureOptions ( new RestClientOptions { BaseUrl = baseUrl } , configureRestClient ) , configureSerialization : configureSerialization ) { }
106
+ public RestClient (
107
+ Uri baseUrl ,
108
+ ConfigureRestClient ? configureRestClient = null ,
109
+ ConfigureHeaders ? configureDefaultHeaders = null ,
110
+ ConfigureSerialization ? configureSerialization = null
111
+ )
112
+ : this (
113
+ ConfigureOptions ( new RestClientOptions { BaseUrl = baseUrl } , configureRestClient ) ,
114
+ configureDefaultHeaders ,
115
+ configureSerialization
116
+ ) { }
93
117
94
118
/// <summary>
95
119
/// Creates an instance of RestClient using a specific BaseUrl for requests made by this client instance
96
120
/// </summary>
97
121
/// <param name="baseUrl">Base URI for this new client as a string</param>
98
122
/// <param name="configureRestClient">Delegate to configure the client options</param>
123
+ /// <param name="configureDefaultHeaders">Delegate to add default headers to the wrapped HttpClient instance</param>
99
124
/// <param name="configureSerialization">Delegate to configure serialization</param>
100
- public RestClient ( string baseUrl , ConfigureRestClient ? configureRestClient = null , ConfigureSerialization ? configureSerialization = null )
101
- : this ( new Uri ( Ensure . NotEmptyString ( baseUrl , nameof ( baseUrl ) ) ) , configureRestClient , configureSerialization ) { }
125
+ public RestClient (
126
+ string baseUrl ,
127
+ ConfigureRestClient ? configureRestClient = null ,
128
+ ConfigureHeaders ? configureDefaultHeaders = null ,
129
+ ConfigureSerialization ? configureSerialization = null
130
+ )
131
+ : this ( new Uri ( Ensure . NotEmptyString ( baseUrl , nameof ( baseUrl ) ) ) , configureRestClient , configureDefaultHeaders , configureSerialization ) { }
102
132
103
133
/// <summary>
104
134
/// Creates an instance of RestClient using a shared HttpClient and specific RestClientOptions and does not allocate one internally.
0 commit comments