HTTPKernel normalizes request bodies through the upstream RequestBodyInterface and RequestBodyType.
The raw body and structured body remain separate:
HttpRequestInterface::body() -> raw string or null
HttpRequestInterface::requestBody() -> normalized body classification
The package currently ships:
LiquidRazor\HttpKernel\Lib\Adapter\HttpRequestBodyNormalizer
Supported outcomes are:
EMPTYRAW_STRINGFORM_FIELDSJSON_ASSOCIATIVEJSON_OBJECTMULTIPARTUNKNOWN
An empty raw body with no structured parameters becomes EMPTY.
application/x-www-form-urlencoded becomes FORM_FIELDS.
Structured parameters are stored in RequestBodyInterface::parameters().
JSON dictionary payloads can become JSON_ASSOCIATIVE.
This mode keeps decoded key/value data in parameters().
JSON object preservation is explicit.
When object preservation is requested, the normalizer produces JSON_OBJECT and stores the decoded object in objects().
multipart/* becomes MULTIPART.
The current implementation keeps multipart metadata in the upstream dictionary-shaped request body form.
Non-empty textual or otherwise unclassified raw payloads become RAW_STRING.
Opaque binary media types such as application/octet-stream become UNKNOWN.
UNKNOWN does not expose normalized parameter or object mappings.
Malformed JSON does not silently degrade.
The normalizer throws HttpRequestBodyNormalizationFailed for:
- malformed JSON
- unsupported JSON top-level shapes for the requested JSON mode
- invalid structured data for the selected request body type
The current implementation expects a top-level JSON object for both supported JSON modes.
Top-level JSON arrays are rejected explicitly instead of being forced into an incorrect body type.