Interface IChangeableHttpBehaviour
This interface extends the IHttpBehaviour but makes it possible to change the values. A use-case would be to call Clone on the IHttpBehaviour and modify the settings, return/assign the new value to a IHttpBehaviour This would be needed to pass the IHttpBehaviour via a CallContext.
Namespace: Dapplo.HttpExtensions
Assembly: Dapplo.HttpExtensions.dll
Syntax
public interface IChangeableHttpBehaviour : IHttpBehaviour
Properties
| Improve this Doc View SourceCookieContainer
This cookie container will be assed when creating the HttpMessageHandler and UseCookies is true
Declaration
CookieContainer CookieContainer { get; set; }
Property Value
| Type | Description |
|---|---|
| CookieContainer |
DefaultEncoding
The default encoding which is used wherever an encoding is specified. The default is set to Encoding.UTF8
Declaration
Encoding DefaultEncoding { get; set; }
Property Value
| Type | Description |
|---|---|
| Encoding |
DownloadProgress
Action which is called to notify of download progress. Only used when using non-string content like Bitmaps or MemoryStreams. Also the UseProgressStream needs to be true for this download progress
Declaration
Action<float> DownloadProgress { get; set; }
Property Value
| Type | Description |
|---|---|
| Action<System.Single> |
HttpCompletionOption
This can be used to change the behaviour of Http operation, default is to read the complete response.
Declaration
HttpCompletionOption HttpCompletionOption { get; set; }
Property Value
| Type | Description |
|---|---|
| HttpCompletionOption |
HttpContentConverters
This is the list of IHttpContentConverters which is used when converting from/to HttpContent
Declaration
IList<IHttpContentConverter> HttpContentConverters { get; set; }
Property Value
| Type | Description |
|---|---|
| IList<IHttpContentConverter> |
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; set; }
Property Value
| Type | Description |
|---|---|
| IHttpSettings |
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; set; }
Property Value
| Type | Description |
|---|---|
| IJsonSerializer |
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; set; }
Property Value
| Type | Description |
|---|---|
| Action<HttpClient> |
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; set; }
Property Value
| Type | Description |
|---|---|
| Func<HttpContent, HttpContent> |
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; set; }
Property Value
| Type | Description |
|---|---|
| Func<HttpMessageHandler, HttpMessageHandler> |
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; set; }
Property Value
| Type | Description |
|---|---|
| Func<HttpRequestMessage, HttpRequestMessage> |
ReadBufferSize
Specify the buffer for reading operations
Declaration
int ReadBufferSize { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
RequestConfigurations
The IHttpBehaviour is used to control the behaviour of all operations in the HttpExtensions library.
Declaration
IDictionary<string, IHttpRequestConfiguration> RequestConfigurations { get; set; }
Property Value
| Type | Description |
|---|---|
| IDictionary<System.String, IHttpRequestConfiguration> |
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; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
UploadProgress
Action which is called to notify of upload progress. Only used when using non-string content like Bitmaps or MemoryStreams. Also the UseProgressStream needs to be true for this upload progress
Declaration
Action<float> UploadProgress { get; set; }
Property Value
| Type | Description |
|---|---|
| Action<System.Single> |
UseProgressStream
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 UseProgressStream { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
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; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |