Class PayloadHandler
A class responsible for providing body and message content.
Inheritance
Implements
Inherited Members
Namespace: Okta.Sdk.Internal
Assembly: Okta.Sdk.dll
Syntax
public abstract class PayloadHandler : IPayloadHandler
Constructors
PayloadHandler()
Initializes a new instance of the PayloadHandler class.
Declaration
protected PayloadHandler()
Properties
ContentTransferEncoding
Gets or sets the content transfer encoding.
Declaration
protected string ContentTransferEncoding { get; set; }
Property Value
Type | Description |
---|---|
System.String |
ContentType
Gets the content type.
Declaration
public string ContentType { get; protected set; }
Property Value
Type | Description |
---|---|
System.String |
Default
The default payload handler.
Declaration
public static IPayloadHandler Default { get; }
Property Value
Type | Description |
---|---|
IPayloadHandler |
Methods
ForContentType(String)
Get the payload handler registered for the specified content type.
Declaration
public static IPayloadHandler ForContentType(string contentType)
Parameters
Type | Name | Description |
---|---|---|
System.String | contentType | The content type whose payload handler is returned. |
Returns
Type | Description |
---|---|
IPayloadHandler | A payload handler. |
GetBody(HttpRequest)
Gets the body for the specified request.
Declaration
public virtual string GetBody(HttpRequest httpRequest)
Parameters
Type | Name | Description |
---|---|---|
HttpRequest | httpRequest | The request whose body is retrieved. |
Returns
Type | Description |
---|---|
System.String | The request body. |
GetRequestHttpContent(HttpRequest)
Get content for the specified request.
Declaration
protected abstract HttpContent GetRequestHttpContent(HttpRequest httpRequest)
Parameters
Type | Name | Description |
---|---|---|
HttpRequest | httpRequest | The request whose content is returned. |
Returns
Type | Description |
---|---|
System.Net.Http.HttpContent | Content for the specified request. |
SetHttpRequestMessageContent(HttpRequest, HttpRequestMessage)
Set the content of the specified request message based on the specified request.
Declaration
public virtual void SetHttpRequestMessageContent(HttpRequest httpRequest, HttpRequestMessage httpRequestMessage)
Parameters
Type | Name | Description |
---|---|---|
HttpRequest | httpRequest | The request used to create the message content. |
System.Net.Http.HttpRequestMessage | httpRequestMessage | The message whose content is set. |
TryRegister(IPayloadHandler)
Register the specified payload handler.
Declaration
public static bool TryRegister(IPayloadHandler payloadHandler)
Parameters
Type | Name | Description |
---|---|---|
IPayloadHandler | payloadHandler | The payload handler instance to register. |
Returns
Type | Description |
---|---|
System.Boolean | True if successfully registered. |
TryRegister<T>()
Register the specified generic payload handler.
Declaration
public static bool TryRegister<T>()
where T : PayloadHandler, new()
Returns
Type | Description |
---|---|
System.Boolean | True if successfully registered. |
Type Parameters
Name | Description |
---|---|
T | The type of the payload handler to register. |
ValidateRequest(HttpRequest)
Validate the specified request.
Declaration
protected void ValidateRequest(HttpRequest httpRequest)
Parameters
Type | Name | Description |
---|---|---|
HttpRequest | httpRequest | The request to validate. |
Remarks
Throws an ArgumentNullException if the specified request is null. Throws an InvalidOperationException if the current payload handler is not for the content type of the specified request