Show / Hide Table of Contents

Class JsonBodyParser<TModel>

Body parser that accepts JSON request bodies

Inheritance
Object
JsonBodyParser<TModel>
Implements
IBodyParser<TModel>
Namespace: Seltzr.Parsers
Assembly: Seltzr.dll
Syntax
C#
public class JsonBodyParser<TModel> : IBodyParser<TModel> where TModel : class
Type Parameters
TModel

The type of model to parse

Constructors

| Improve this Doc View Source

JsonBodyParser()

Initializes a new instance of the JsonBodyParser<TModel> class

C#
public JsonBodyParser()
| Improve this Doc View Source

JsonBodyParser(JsonSerializerOptions)

Initializes a new instance of the JsonBodyParser<TModel> class

C#
public JsonBodyParser(JsonSerializerOptions serializerOptions)
Parameters
serializerOptionsJsonSerializerOptions

Options for the JSON serializer

Methods

| Improve this Doc View Source

CanParse(HttpContext)

Gets whether or not the request body can be parsed by this IBodyParser<TModel>

C#
public virtual Task<bool> CanParse(HttpContext context)
Parameters
contextHttpContext

The context for the HTTP request

Returns

Task<Boolean>

true if the request body can be parsed by this IBodyParser<TModel>, false otherwise

| Improve this Doc View Source

Parse(Byte[], ParserOptions, HttpContext)

Parses a request body

C#
public virtual Task<ParseResult<TModel>[]> Parse(byte[] body, ParserOptions options, HttpContext context)
Parameters
bodyByte[]

The data of the request body

optionsParserOptions

Options for the parser

contextHttpContext

The context for the HTTP request

Returns

Task<ParseResult<TModel>[]>

The parsed object

Implements

IBodyParser<TModel>
  • Improve this Doc
  • View Source
Back to top Generated by DocFX