Class HttpRequestPropertiesBuilderExtensions
Defines the static methods for an IHttpRequestPropertiesBuilder provided by the library.
Namespace: ReqRest.Builders
Assembly: ReqRest.dll
Syntax
public static class HttpRequestPropertiesBuilderExtensions
Methods
AddProperty<T>(T, String, Nullable<Object>)
Adds the specified property and value to the properties of the HTTP request which
is being built.
If a property with the specified key already exists, an exception
is thrown.
Declaration
public static T AddProperty<T>(this T builder, string key, object? value)
where T : IHttpRequestPropertiesBuilder
Parameters
| Type | Name | Description |
|---|---|---|
| T | builder | The builder. |
| String | key | The key of the property. |
| Nullable<Object> | value | The value of the property. This can be null. |
Returns
| Type | Description |
|---|---|
| T | The specified |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the builder. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | The properties already contain a property with the |
| ArgumentNullException |
|
ClearProperties<T>(T)
Removes all properties from the properties of the HTTP request which is being built.
Declaration
public static T ClearProperties<T>(this T builder)
where T : IHttpRequestPropertiesBuilder
Parameters
| Type | Name | Description |
|---|---|---|
| T | builder | The builder. |
Returns
| Type | Description |
|---|---|
| T | The specified |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the builder. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
ConfigureProperties<T>(T, Action<IDictionary<String, Nullable<Object>>>)
Executes the specified configureProperties function to modify the
properties of the HTTP request which is being built.
Declaration
public static T ConfigureProperties<T>(this T builder, Action<IDictionary<string, object? >> configureProperties)
where T : IHttpRequestPropertiesBuilder
Parameters
| Type | Name | Description |
|---|---|---|
| T | builder | The builder. |
| Action<IDictionary<String, Nullable<Object>>> | configureProperties | A function which receives the request's properties. The function can then modify the properties as desired. |
Returns
| Type | Description |
|---|---|
| T | The specified |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the builder. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
RemoveProperty<T>(T, Nullable<String>[], names)
Removes the properties with the specified names from the properties of the HTTP request which is being built.
Declaration
public static T RemoveProperty<T>(this T builder, params string? [], names)
where T : IHttpRequestPropertiesBuilder
Parameters
| Type | Name | Description |
|---|---|---|
| T | builder | The builder. |
| Nullable<String>[] | ||
| names |
Returns
| Type | Description |
|---|---|
| T | The specified |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the builder. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
SetProperty<T>(T, String, Nullable<Object>)
Adds the specified property and value to the properties of the HTTP request
which is being built.
If a property with the specified key already exists,
it is overwritten.
Declaration
public static T SetProperty<T>(this T builder, string key, object? value)
where T : IHttpRequestPropertiesBuilder
Parameters
| Type | Name | Description |
|---|---|---|
| T | builder | The builder. |
| String | key | The key of the property. |
| Nullable<Object> | value | The value of the property. This can be null. |
Returns
| Type | Description |
|---|---|
| T | The specified |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the builder. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|