@@ -33,6 +33,7 @@ namespace RestSharp;
3333/// <summary>
3434/// Client to translate RestRequests into Http requests and process response result
3535/// </summary>
36+ // ReSharper disable once ClassWithVirtualMembersNeverInherited.Global
3637public partial class RestClient : IRestClient {
3738 /// <summary>
3839 /// Content types that will be sent in the Accept header. The list is populated from the known serializers.
@@ -55,11 +56,6 @@ public string[] AcceptedContentTypes {
5556 /// <inheritdoc/>
5657 public DefaultParameters DefaultParameters { get ; }
5758
58- [ Obsolete ( "Use RestClientOptions.Authenticator instead" ) ]
59- public IAuthenticator ? Authenticator => Options . Authenticator ;
60-
61- // set => Options.Authenticator = value;
62-
6359 /// <summary>
6460 /// Creates an instance of RestClient using the provided <see cref="RestClientOptions"/>
6561 /// </summary>
@@ -226,7 +222,6 @@ public RestClient(
226222 : this ( new HttpClient ( handler , disposeHandler ) , true , configureRestClient , configureSerialization ) { }
227223
228224 static void ConfigureHttpClient ( HttpClient httpClient , RestClientOptions options ) {
229-
230225 // We will use Options.Timeout in ExecuteAsInternalAsync method
231226 httpClient . Timeout = Timeout . InfiniteTimeSpan ;
232227
@@ -259,6 +254,7 @@ static void ConfigureHttpMessageHandler(HttpClientHandler handler, RestClientOpt
259254 handler . AllowAutoRedirect = options . FollowRedirects ;
260255
261256#if NET
257+ // ReSharper disable once InvertIf
262258 if ( ! OperatingSystem . IsBrowser ( ) && ! OperatingSystem . IsIOS ( ) && ! OperatingSystem . IsTvOS ( ) ) {
263259#endif
264260 if ( handler . SupportsProxy ) handler . Proxy = options . Proxy ;
@@ -278,12 +274,12 @@ void ConfigureSerializers(ConfigureSerialization? configureSerialization) {
278274 }
279275
280276 void ConfigureDefaultParameters ( RestClientOptions options ) {
281- if ( options . UserAgent != null ) {
282- if ( ! options . AllowMultipleDefaultParametersWithSameName
283- && DefaultParameters . Any ( parameter => parameter . Type == ParameterType . HttpHeader && parameter . Name == KnownHeaders . UserAgent ) )
284- DefaultParameters . RemoveParameter ( KnownHeaders . UserAgent , ParameterType . HttpHeader ) ;
285- DefaultParameters . AddParameter ( Parameter . CreateParameter ( KnownHeaders . UserAgent , options . UserAgent , ParameterType . HttpHeader ) ) ;
286- }
277+ if ( options . UserAgent == null ) return ;
278+
279+ if ( ! options . AllowMultipleDefaultParametersWithSameName
280+ && DefaultParameters . Any ( parameter => parameter . Type == ParameterType . HttpHeader && parameter . Name == KnownHeaders . UserAgent ) )
281+ DefaultParameters . RemoveParameter ( KnownHeaders . UserAgent , ParameterType . HttpHeader ) ;
282+ DefaultParameters . AddParameter ( Parameter . CreateParameter ( KnownHeaders . UserAgent , options . UserAgent , ParameterType . HttpHeader ) ) ;
287283 }
288284
289285 readonly bool _disposeHttpClient ;
0 commit comments