|
SimpleREST.NET 0.1
A simple and minimal api framework for .net base on Express.js
|
The body of a SimpleRest.Api.SimpleRestRequest. This class encapsulates the content of an HTTP request body, providing access to both raw byte data and deserialized content. More...
Public Member Functions | |
| SimpleRestBody (string contents, JsonSerializerOptions jsonOptions) | |
| SimpleRestBody (HttpListenerRequest request, JsonSerializerOptions jsonOptions) | |
| Initializes a new instance of the SimpleRestBody class using the specified HttpListenerRequest. | |
| T? | As< T > () |
The function As<T> returns the content as type T if T is a reference type. | |
| TBody? | GetContent< TBody > () |
The function GetContent<TBody> deserializes the Content property into an object of type TBody . | |
Properties | |
| string | Content [get] |
| Gets the content of the request body as a UTF-8 encoded string. | |
| byte[] | Bytes [get] |
| Gets the raw content of the request body as a byte array. | |
The body of a SimpleRest.Api.SimpleRestRequest. This class encapsulates the content of an HTTP request body, providing access to both raw byte data and deserialized content.
Definition at line 128 of file SimpleRestRequest.cs.
| SimpleRest.Api.SimpleRestBody.SimpleRestBody | ( | string | contents, |
| JsonSerializerOptions | jsonOptions ) |
Definition at line 131 of file SimpleRestRequest.cs.
| SimpleRest.Api.SimpleRestBody.SimpleRestBody | ( | HttpListenerRequest | request, |
| JsonSerializerOptions | jsonOptions ) |
Initializes a new instance of the SimpleRestBody class using the specified HttpListenerRequest.
| request | The HttpListenerRequest from which to read the body content. |
Definition at line 142 of file SimpleRestRequest.cs.
| T? SimpleRest.Api.SimpleRestBody.As< T > | ( | ) |
The function As<T> returns the content as type T if T is a reference type.
| T | The type to which the content should be deserialized. |
null if the conversion fails. Definition at line 171 of file SimpleRestRequest.cs.
| TBody? SimpleRest.Api.SimpleRestBody.GetContent< TBody > | ( | ) |
The function GetContent<TBody> deserializes the Content property into an object of type TBody .
| TBody | The type to which the content should be deserialized. |
null if the deserialization fails. Definition at line 184 of file SimpleRestRequest.cs.
|
get |
Gets the raw content of the request body as a byte array.
Definition at line 162 of file SimpleRestRequest.cs.
|
get |
Gets the content of the request body as a UTF-8 encoded string.
Definition at line 157 of file SimpleRestRequest.cs.