Class HttpHeadersBuilderExtensions
Defines the static methods for an IHttpHeadersBuilder provided by the library.
Namespace: ReqRest.Builders
Assembly: ReqRest.dll
Syntax
public static class HttpHeadersBuilderExtensions
Methods
AddHeader<T>(T, String)
Adds the specified header without any value to the HttpHeaders which are being built.
Declaration
public static T AddHeader<T>(this T builder, string name)
where T : IHttpHeadersBuilder
Parameters
Type | Name | Description |
---|---|---|
T | builder | The builder. |
String | name | The name of the header. |
Returns
Type | Description |
---|---|
T | The specified |
Type Parameters
Name | Description |
---|---|
T | The type of the builder. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
AddHeader<T>(T, String, Nullable<IEnumerable<Nullable<String>>>)
Adds the specified header and its values to the HttpHeaders which are being built.
Declaration
public static T AddHeader<T>(this T builder, string name, IEnumerable<string? >? values)
where T : IHttpHeadersBuilder
Parameters
Type | Name | Description |
---|---|---|
T | builder | The builder. |
String | name | The name of the header. |
Nullable<IEnumerable<Nullable<String>>> | values | The content/values of the header. This can be null. |
Returns
Type | Description |
---|---|
T | The specified |
Type Parameters
Name | Description |
---|---|
T | The type of the builder. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
AddHeader<T>(T, String, Nullable<String>)
Adds the specified header and its value to the HttpHeaders which are being built.
Declaration
public static T AddHeader<T>(this T builder, string name, string? value)
where T : IHttpHeadersBuilder
Parameters
Type | Name | Description |
---|---|---|
T | builder | The builder. |
String | name | The name of the header. |
Nullable<String> | value | The content/value of the header. This can be null. |
Returns
Type | Description |
---|---|
T | The specified |
Type Parameters
Name | Description |
---|---|
T | The type of the builder. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
ClearHeaders<T>(T)
Removes all headers from the HttpHeaders which are being built.
Declaration
public static T ClearHeaders<T>(this T builder)
where T : IHttpHeadersBuilder
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 |
|
ConfigureHeaders<T>(T, Action<HttpHeaders>)
Executes the specified configureHeaders
function to modify the
HttpHeaders which are being built.
Declaration
public static T ConfigureHeaders<T>(this T builder, Action<HttpHeaders> configureHeaders)
where T : IHttpHeadersBuilder
Parameters
Type | Name | Description |
---|---|---|
T | builder | The builder. |
Action<HttpHeaders> | configureHeaders | A function which receives the HttpHeaders object. The function can then modify the headers as desired. |
Returns
Type | Description |
---|---|
T | The specified |
Type Parameters
Name | Description |
---|---|
T | The type of the builder. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
RemoveHeader<T>(T, Nullable<String>[], names)
Removes the headers with the specified names from the HttpHeaders which are being built.
Declaration
public static T RemoveHeader<T>(this T builder, params string? [], names)
where T : IHttpHeadersBuilder
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 |
|
SetHeader<T>(T, String)
Sets the specified header without any value by first removing any previous header
value with the specified name
and then adding the new one.
Declaration
public static T SetHeader<T>(this T builder, string name)
where T : IHttpHeadersBuilder
Parameters
Type | Name | Description |
---|---|---|
T | builder | The builder. |
String | name | The name of the header. |
Returns
Type | Description |
---|---|
T | The specified |
Type Parameters
Name | Description |
---|---|
T | The type of the builder. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
SetHeader<T>(T, String, Nullable<IEnumerable<Nullable<String>>>)
Sets the specified header and its values by first removing any previous header
value with the specified name
and then adding the new one.
Declaration
public static T SetHeader<T>(this T builder, string name, IEnumerable<string? >? values)
where T : IHttpHeadersBuilder
Parameters
Type | Name | Description |
---|---|---|
T | builder | The builder. |
String | name | The name of the header. |
Nullable<IEnumerable<Nullable<String>>> | values | The content/values of the header. This can be null. |
Returns
Type | Description |
---|---|
T | The specified |
Type Parameters
Name | Description |
---|---|
T | The type of the builder. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
SetHeader<T>(T, String, Nullable<String>)
Sets the specified header and its value by first removing any previous header
value with the specified name
and then adding the new one.
Declaration
public static T SetHeader<T>(this T builder, string name, string? value)
where T : IHttpHeadersBuilder
Parameters
Type | Name | Description |
---|---|---|
T | builder | The builder. |
String | name | The name of the header. |
Nullable<String> | value | The content/value of the header. This can be null. |
Returns
Type | Description |
---|---|
T | The specified |
Type Parameters
Name | Description |
---|---|
T | The type of the builder. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|