Skip to content
This repository was archived by the owner on Jan 21, 2020. It is now read-only.
This repository was archived by the owner on Jan 21, 2020. It is now read-only.

BodyParamsMiddleware: Valid JSON containing a scalar value causes InvalidArgumentException #67

Description

@ketners

If the request body contains a valid scalar JSON value e.g. string, boolean or int, an InvalidArgumentException is thrown.

Code to reproduce the issue

Using BodyParamsMiddleware with the standard JsonStartegy.

Like described here: https://docs.zendframework.com/zend-expressive/v3/features/helpers/body-parse/

Send a request with the Content-Type header 'application/json' and the body containing any of this:

  • "string"
  • false
  • true
  • 123

Expected results

Expecting to use \Psr\Http\Message\ServerRequestInterface::getParsedBody().

Actual results

InvalidArgumentException
Zend\Diactoros\ServerRequest::withParsedBody expects a null, array, or object argument; received integer

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions