Improve this Doc View Source

Interface IHttpBehaviour

The IHttpBehaviour is used to control the behaviour of all operations in the HttpExtensions library.

Namespace:Dapplo.HttpExtensions
Assembly:Dapplo.HttpExtensions.dll
Syntax
public interface IHttpBehaviour

Properties

| Improve this Doc View Source

DefaultEncoding

The default encoding which is used wherever an encoding is specified. The default is set to Encoding.UTF8

Declaration
Encoding DefaultEncoding { get; }
Returns
Type Description
System.Text.Encoding
| Improve this Doc View Source

HttpCompletionOption

This can be used to change the behaviour of Http operation, default is to read the complete response.

Declaration
HttpCompletionOption HttpCompletionOption { get; }
Returns
Type Description
System.Net.Http.HttpCompletionOption
| Improve this Doc View Source

HttpContentConverters

This is the list of IHttpContentConverters which is used when converting from/to HttpContent

Declaration
IList<IHttpContentConverter> HttpContentConverters { get; }
Returns
Type Description
System.Collections.Generic.IList<IHttpContentConverter>
| Improve this Doc View Source

HttpSettings

Pass your HttpSettings here, which will be used to create the HttpClient If not specified, the HttpSettings.GlobalSettings will be used

Declaration
IHttpSettings HttpSettings { get; }
Returns
Type Description
IHttpSettings
| Improve this Doc View Source

JsonSerializer

This is used to de- serialize Json, can be overwritten by your own implementation. By default, also when empty, the SimpleJsonSerializer is used.

Declaration
IJsonSerializer JsonSerializer { get; }
Returns
Type Description
IJsonSerializer
| Improve this Doc View Source

OnHttpClientCreated

An action which can modify the HttpClient which is generated in the HttpClientFactory. Use cases for this, might be adding a header or other settings for specific cases

Declaration
Action<HttpClient> OnHttpClientCreated { get; }
Returns
Type Description
System.Action<System.Net.Http.HttpClient>
| Improve this Doc View Source

OnHttpContentCreated

An Func which can modify the HttpContent right before it's used to start the request. This can be used to add a specific header, e.g. set a filename etc, or return a completely different HttpContent type

Declaration
Func<HttpContent, HttpContent> OnHttpContentCreated { get; }
Returns
Type Description
System.Func<System.Net.Http.HttpContent, System.Net.Http.HttpContent>
| Improve this Doc View Source

OnHttpMessageHandlerCreated

An Func which can modify or wrap the HttpMessageHandler which is generated in the HttpMessageHandlerFactory. Use cases for this, might be if you have very specify settings which can't be set via the IHttpSettings Or you want to add additional behaviour (extend DelegatingHandler!!) like the OAuthDelegatingHandler

Declaration
Func<HttpMessageHandler, HttpMessageHandler> OnHttpMessageHandlerCreated { get; }
Returns
Type Description
System.Func<System.Net.Http.HttpMessageHandler, System.Net.Http.HttpMessageHandler>
| Improve this Doc View Source

OnHttpRequestMessageCreated

An Func which can modify the HttpRequestMessage right before it's used to start the request. This can be used to add a specific header, which should not be for all requests. As the called func has access to HttpRequestMessage with the content, uri and method this is quite usefull, it can return a completely different HttpRequestMessage

Declaration
Func<HttpRequestMessage, HttpRequestMessage> OnHttpRequestMessageCreated { get; }
Returns
Type Description
System.Func<System.Net.Http.HttpRequestMessage, System.Net.Http.HttpRequestMessage>
| Improve this Doc View Source

ReadBufferSize

Specify the buffer for reading operations

Declaration
int ReadBufferSize { get; }
Returns
Type Description
System.Int32
| Improve this Doc View Source

ThrowOnError

If a request gets a response which has a HTTP status code which is an error, it would normally THROW an exception. Sometimes you would still want the response, settings this to false would allow this. This can be ignored for all HttpResponse returning methods.

Declaration
bool ThrowOnError { get; }
Returns
Type Description
System.Boolean
| Improve this Doc View Source

UploadProgress

IProgress for uploading, only used when using non-string content like Bitmaps or MemoryStreams. Also the UseProgressStreamContent needs to be true for detailed upload progress

Declaration
IProgress<float> UploadProgress { get; }
Returns
Type Description
System.IProgress<System.Single>
| Improve this Doc View Source

UseProgressStreamContent

Whenever a post is made to upload memorystream or bitmaps, this value is used to decide: true: ProgressStreamContent is used, instead of StreamContent

Declaration
bool UseProgressStreamContent { get; }
Returns
Type Description
System.Boolean
| Improve this Doc View Source

ValidateResponseContentType

Check if the response has the expected content-type, when servers are used that are not following specifications this should be set to false

Declaration
bool ValidateResponseContentType { get; }
Returns
Type Description
System.Boolean

Methods

| Improve this Doc View Source

Clone()

Clone this HttpBehavior and return an interface which can be used to write

Declaration
IChangeableHttpBehaviour Clone()
Returns
Type Description
IChangeableHttpBehaviour

IChangeableHttpBehaviour

| Improve this Doc View Source

MakeCurrent()

Set this IHttpBehaviour on the CallContext

Declaration
void MakeCurrent()