1
- // Copyright (c) 2019-2021 ReactiveUI Association Incorporated. All rights reserved.
1
+ // Copyright (c) 2019-2022 ReactiveUI Association Incorporated. All rights reserved.
2
2
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
3
3
// See the LICENSE file in the project root for full license information.
4
4
@@ -48,15 +48,8 @@ public HttpService()
48
48
/// <param name="fetchAlways">Force a web request to always be issued, skipping the cache.</param>
49
49
/// <param name="absoluteExpiration">An optional expiration date.</param>
50
50
/// <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 ) ;
60
53
61
54
/// <summary>
62
55
/// 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
71
64
/// <param name="fetchAlways">Force a web request to always be issued, skipping the cache.</param>
72
65
/// <param name="absoluteExpiration">An optional expiration date.</param>
73
66
/// <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 ) ;
88
70
89
71
/// <summary>
90
72
/// Download data from an HTTP URL and insert the result into the
@@ -186,9 +168,7 @@ protected virtual IObservable<HttpResponseMessage> MakeWebRequest(
186
168
int retries = 3 ,
187
169
TimeSpan ? timeout = null )
188
170
{
189
- IObservable < HttpResponseMessage > request ;
190
-
191
- request = Observable . Defer ( ( ) =>
171
+ var request = Observable . Defer ( ( ) =>
192
172
{
193
173
var httpRequest = CreateWebRequest ( uri , method , headers ) ;
194
174
0 commit comments