Interface IBodyParser<TModel>
Parser for a request body
Namespace: Seltzr.Parsers
Assembly: Seltzr.dll
Syntax
C#
public interface IBodyParser<TModel>
Type Parameters
TModel
The type to parse to
Methods
Gets whether or not the request body can be parsed by this IBodyParser<TModel>
C#
Task<bool> CanParse(HttpContext context)
Parameters
contextHttpContext
The context for the HTTP request
Returns
true if the request body can be parsed by this IBodyParser<TModel>, false otherwise
Parses a request body
C#
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 models