package
0.0.5
Repository: https://github.com/jsautret/genapid.git
Documentation: pkg.go.dev

# README

body

The body predicate checks the Content-Type of the incoming request and/or parse its body.

Options

OptionRequiredDescription
mimeIf set, check that the Mime type of the Content-Type header value of the incoming request matches this value
typeCan be string or json. If set, the body is read and parsed accordingly to this value.
limitMax body size in bytes. If received body is larger, it will be truncated. Default is 1232896 (1Mb).

Results

FieldTypeDescription
resultbooleanfalse if mime was not matched (if set) or body cannot be parsed accordingly to type (if set) or method is GET, HEAD or DELETE
payloaddepends on typeIt type is set, contains the parsed body

Example:

- body:
    mime: application/json
    type: json
  register: body

- log:
    msg: body.payload.token