• Articles
  • Api Documentation
Show / Hide Table of Contents
  • Dapplo.HttpExtensions
    • AuthorizationExtensions
    • HttpBehaviour
    • HttpBehaviourExtensions
    • HttpClientExtensions
    • HttpContentExtensions
    • HttpExtensionsGlobals
    • HttpRequestMessageConfiguration
    • HttpRequestMessageExtensions
    • HttpResponse
    • HttpResponse<TResponse, TErrorResponse>
    • HttpResponse<TResponse>
    • HttpResponseMessageExtensions
    • HttpResponseWithError<TErrorResponse>
    • IChangeableHttpBehaviour
    • IHttpBehaviour
    • IHttpContentConverter
    • IHttpRequestConfiguration
    • IHttpSettings
    • IJsonSerializer
    • MiscExtensions
    • UriActionExtensions
    • UriModifyExtensions
    • UriParseExtensions
  • Dapplo.HttpExtensions.ContentConverter
    • ByteArrayHttpContentConverter
    • DefaultJsonHttpContentConverter
    • DefaultJsonHttpContentConverterConfiguration
    • FormUriEncodedContentConverter
    • StreamHttpContentConverter
    • StringConfiguration
    • StringHttpContentConverter
    • SyndicationFeedHttpContentConverter
    • XDocumentHttpContentConverter
  • Dapplo.HttpExtensions.Extensions
    • EnumExtensions
    • HttpBehaviourExtensions
    • StringExtensions
    • TypeExtensions
  • Dapplo.HttpExtensions.Factory
    • HttpClientFactory
    • HttpContentFactory
    • HttpMessageHandlerFactory
    • HttpRequestMessageFactory
    • WebProxyFactory
  • Dapplo.HttpExtensions.JsonNet
    • JsonNetJsonSerializer
    • ReadOnlyConsideringContractResolver
  • Dapplo.HttpExtensions.JsonSimple
    • DataContractJsonSerializerStrategy
    • DefaultJsonHttpContentConverter
    • IJsonSerializerStrategy
    • JsonExtensionDataAttribute
    • PocoJsonSerializerStrategy
    • SimpleJson
    • SimpleJsonSerializer
  • Dapplo.HttpExtensions.Listener
    • HttpListenerContextExtensions
    • ListenerPortExtensions
    • UriHttpListenerExtensions
  • Dapplo.HttpExtensions.OAuth
    • AuthorizeModes
    • BaseOAuthSettings
    • GrantTypes
    • ICodeReceiverSettings
    • IOAuth1Token
    • IOAuth2Token
    • IOAuthCodeReceiver
    • OAuth1HttpBehaviour
    • OAuth1HttpBehaviourFactory
    • OAuth1HttpMessageHandler
    • OAuth1Parameters
    • OAuth1RequestConfiguration
    • OAuth1Settings
    • OAuth1SignatureTransports
    • OAuth1SignatureTypes
    • OAuth1Token
    • OAuth2HttpBehaviourFactory
    • OAuth2HttpMessageHandler
    • OAuth2Settings
    • OAuth2TokenResponse
    • OAuthExtensions
  • Dapplo.HttpExtensions.OAuth.CodeReceivers
    • EmbeddedBrowserCodeReceiver
  • Dapplo.HttpExtensions.OAuth.Desktop
    • OAuthLoginForm
  • Dapplo.HttpExtensions.Support
    • HttpPartAttribute
    • HttpParts
    • HttpRequestAttribute
    • HttpResponseAttribute
    • HttpSettings
    • MediaTypes
    • ProgressStream
    • ProgressStreamReport
  • Dapplo.HttpExtensions.SystemTextJson
    • SystemTextJsonSerializer
  • Dapplo.HttpExtensions.WinForms.ContentConverter
    • BitmapConfiguration
    • BitmapHttpContentConverter
  • Dapplo.HttpExtensions.Wpf.ContentConverter
    • BitmapSourceConfiguration
    • BitmapSourceHttpContentConverter

Class HttpContentExtensions

Extensions for the HttpContent

Inheritance
System.Object
HttpContentExtensions
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Dapplo.HttpExtensions
Assembly: Dapplo.HttpExtensions.dll
Syntax
public static class HttpContentExtensions

Methods

| Improve this Doc View Source

GetAsAsync(HttpContent, Type, HttpStatusCode, CancellationToken)

Extension method reading the httpContent to a Typed object, depending on the returned content-type Currently we support: Json objects which are annotated with the DataContract/DataMember attributes

Declaration
public static async Task<object> GetAsAsync(this HttpContent httpContent, Type resultType, HttpStatusCode httpStatusCode, CancellationToken cancellationToken = null)
Parameters
Type Name Description
HttpContent httpContent

HttpContent

Type resultType

The Type to read into

HttpStatusCode httpStatusCode

HttpStatusCode

CancellationToken cancellationToken

CancellationToken

Returns
Type Description
Task<System.Object>

the deserialized object of type T

| Improve this Doc View Source

GetAsAsync<TResult>(HttpContent, HttpStatusCode, CancellationToken)

Extension method reading the httpContent to a Typed object, depending on the returned content-type Currently we support: Json objects which are annotated with the DataContract/DataMember attributes

Declaration
public static async Task<TResult> GetAsAsync<TResult>(this HttpContent httpContent, HttpStatusCode httpStatusCode, CancellationToken cancellationToken = null)
    where TResult : class
Parameters
Type Name Description
HttpContent httpContent

HttpContent

HttpStatusCode httpStatusCode

HttpStatusCode

CancellationToken cancellationToken

CancellationToken

Returns
Type Description
Task<TResult>

the deserialized object of type T

Type Parameters
Name Description
TResult

The Type to read into

| Improve this Doc View Source

GetContentStream(HttpContent)

Get the Content-stream of the HttpContent, wrap it in ProgressStream if this is specified

Declaration
public static async Task<Stream> GetContentStream(this HttpContent httpContent)
Parameters
Type Name Description
HttpContent httpContent
Returns
Type Description
Task<System.IO.Stream>

Stream from ReadAsStreamAsync eventually wrapped by ProgressStream

| Improve this Doc View Source

GetContentType(HttpContent)

Simply return the content type of the HttpContent

Declaration
public static string GetContentType(this HttpContent httpContent)
Parameters
Type Name Description
HttpContent httpContent

HttpContent

Returns
Type Description
System.String

string with the content type

| Improve this Doc View Source

SetContentType(HttpContent, String)

Simply set the content type of the HttpContent

Declaration
public static void SetContentType(this HttpContent httpContent, string contentType)
Parameters
Type Name Description
HttpContent httpContent

HttpContent

System.String contentType

Content-Type to set

  • Improve this Doc
  • View Source
In This Article
Back to top Copyright © Dapplo