Click or drag to resize

RestClientReadResponseBodyTResult Method

Read the response body from the from HttpWebResponse.

Namespace: SanteDB.Core.Http
Assembly: SanteDB.Core.Api (in SanteDB.Core.Api.dll) Version: 3.0.2081-alpha+b4ae72647f2cc271f89142f76fff26ad69e00f5a
Syntax
protected virtual Object ReadResponseBody<TResult>(
	HttpWebResponse response
)

Parameters

response  HttpWebResponse
The web response to read the body from.

Type Parameters

TResult
The desired type of the result.

Return Value

Object
An object that is derived from the response of the request. If TResult is byte, The response will be a byte-array. If TResult is Stream, then the response will be a stream. Otherwise, the type is determined by the IContentTypeMapper as part of the configuration.
Remarks

Special handling is provided for some types.

If TResult is byte, then the body will be read through a buffer into a byte array and returned, regardless of the IContentTypeMapper configured for the client.

If TResult is Stream, then the body will be read into a MemoryStream which will be returned. Callers are responsible for disposing this stream.

See Also