-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start porting request templates (etc) from HTTPlease
- Loading branch information
Showing
52 changed files
with
6,232 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System; | ||
|
||
namespace KubeClient.Http | ||
{ | ||
/// <summary> | ||
/// Extension methods for <see cref="HttpRequestFactory"/>. | ||
/// </summary> | ||
public static class FactoryExtensions | ||
{ | ||
/// <summary> | ||
/// Create a new HTTP request with the specified request URI. | ||
/// </summary> | ||
/// <param name="requestFactory"> | ||
/// The HTTP request factory. | ||
/// </param> | ||
/// <param name="requestUri"> | ||
/// The request URI (can be relative or absolute). | ||
/// </param> | ||
/// <returns> | ||
/// The new <see cref="HttpRequest"/>. | ||
/// </returns> | ||
public static HttpRequest Create(this HttpRequestFactory requestFactory, string requestUri) | ||
{ | ||
if (requestFactory == null) | ||
throw new ArgumentNullException(nameof(requestFactory)); | ||
|
||
if (String.IsNullOrWhiteSpace(requestUri)) | ||
throw new ArgumentException("Argument cannot be null, empty, or composed entirely of whitespace: 'requestUri'.", nameof(requestUri)); | ||
|
||
return requestFactory.Create( | ||
new Uri(requestUri, UriKind.RelativeOrAbsolute) | ||
); | ||
} | ||
} | ||
} |
Oops, something went wrong.