Click or drag to resize

RestClientWriteRequestBodyAsyncTBody Method

Write the body of the request if provided to the HttpWebRequest.

Namespace: SanteDB.Core.Http
Assembly: SanteDB.Core.Api (in SanteDB.Core.Api.dll) Version: 3.0.2081-alpha+b4ae72647f2cc271f89142f76fff26ad69e00f5a
Syntax
protected virtual Task WriteRequestBodyAsync<TBody>(
	string contentType,
	TBody body,
	HttpWebRequest webrequest
)

Parameters

contentType  String
The content type header that will be the type of content to send in the request.
body  TBody
The object representing the body of the request.
webrequest  HttpWebRequest
The request object to write the body to.

Type Parameters

TBody
The type of body that is provided.

Return Value

Task
A task that can be awaited while the operation completes.
Exceptions
ExceptionCondition
InvalidOperationExceptionCan be thrown when no serializer is available for the TBody type.
Remarks

Special handling is provided for some types of TBody:

If TBody is byte, the body will be copied directly from the array to the request stream.

If TBody is Stream, the body will be copied directly from the stream to the request stream.

See Also