1- // Copyright (c) 2019-2021 ReactiveUI Association Incorporated. All rights reserved.
1+ // Copyright (c) 2019-2022 ReactiveUI Association Incorporated. All rights reserved.
22// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
33// See the LICENSE file in the project root for full license information.
44
@@ -48,15 +48,8 @@ public HttpService()
4848 /// <param name="fetchAlways">Force a web request to always be issued, skipping the cache.</param>
4949 /// <param name="absoluteExpiration">An optional expiration date.</param>
5050 /// <returns>The data downloaded from the URL.</returns>
51- public IObservable < byte [ ] > DownloadUrl ( IBlobCache blobCache , string url , HttpMethod ? method = default , IEnumerable < KeyValuePair < string , string > > ? headers = null , bool fetchAlways = false , DateTimeOffset ? absoluteExpiration = null )
52- {
53- if ( blobCache is null )
54- {
55- throw new ArgumentNullException ( nameof ( blobCache ) ) ;
56- }
57-
58- return blobCache . DownloadUrl ( url , url , method , headers , fetchAlways , absoluteExpiration ) ;
59- }
51+ public IObservable < byte [ ] > DownloadUrl ( IBlobCache blobCache ! ! , string url , HttpMethod ? method = default , IEnumerable < KeyValuePair < string , string > > ? headers = null , bool fetchAlways = false , DateTimeOffset ? absoluteExpiration = null ) =>
52+ blobCache . DownloadUrl ( url , url , method , headers , fetchAlways , absoluteExpiration ) ;
6053
6154 /// <summary>
6255 /// Download data from an HTTP URL and insert the result into the
@@ -71,20 +64,9 @@ public IObservable<byte[]> DownloadUrl(IBlobCache blobCache, string url, HttpMet
7164 /// <param name="fetchAlways">Force a web request to always be issued, skipping the cache.</param>
7265 /// <param name="absoluteExpiration">An optional expiration date.</param>
7366 /// <returns>The data downloaded from the URL.</returns>
74- public IObservable < byte [ ] > DownloadUrl ( IBlobCache blobCache , Uri url , HttpMethod ? method = default , IEnumerable < KeyValuePair < string , string > > ? headers = null , bool fetchAlways = false , DateTimeOffset ? absoluteExpiration = null )
75- {
76- if ( blobCache is null )
77- {
78- throw new ArgumentNullException ( nameof ( blobCache ) ) ;
79- }
80-
81- if ( url is null )
82- {
83- throw new ArgumentNullException ( nameof ( url ) ) ;
84- }
85-
86- return blobCache . DownloadUrl ( url . ToString ( ) , url , method , headers , fetchAlways , absoluteExpiration ) ;
87- }
67+ public IObservable < byte [ ] > DownloadUrl ( IBlobCache blobCache ! ! , Uri url , HttpMethod ? method = default , IEnumerable < KeyValuePair < string , string > > ? headers = null , bool fetchAlways = false , DateTimeOffset ? absoluteExpiration = null ) => url is null
68+ ? throw new ArgumentNullException ( nameof ( url ) )
69+ : blobCache . DownloadUrl ( url . ToString ( ) , url , method , headers , fetchAlways , absoluteExpiration ) ;
8870
8971 /// <summary>
9072 /// Download data from an HTTP URL and insert the result into the
@@ -186,9 +168,7 @@ protected virtual IObservable<HttpResponseMessage> MakeWebRequest(
186168 int retries = 3 ,
187169 TimeSpan ? timeout = null )
188170 {
189- IObservable < HttpResponseMessage > request ;
190-
191- request = Observable . Defer ( ( ) =>
171+ var request = Observable . Defer ( ( ) =>
192172 {
193173 var httpRequest = CreateWebRequest ( uri , method , headers ) ;
194174
0 commit comments