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

Test to cover zendframework/zend-expressive#371 #43

Merged

Conversation

weierophinney
Copy link
Member

Creates an integration test to attempt to recreate the problem reported in zendframework/zend-expressive#371. It sets up the following conditions:

  • A request method that can provide body content
  • A request body with JSON content
  • A Content-Type request header with the value application/json;charset=utf-8

It then passes the request to the BodyParams middleware, and validates that the request received by the delegate has the parsed contents.

Unfortunately... it does not validate the issue reported, as the test passes.

Creates an integration test to attempt to recreate the problem reported
in zendframework/zend-expressive#371. It sets up the following
conditions:

- A request method that can provide body content
- A request body with JSON content
- A `Content-Type` request header with the value `application/json;charset=utf-8`

It then passes the request to the `BodyParams` middleware, and validates
that the request received by the delegate has the parsed contents.

Unfortunately... it does not validate the issue reported, as the test
passes.
@weierophinney
Copy link
Member Author

Ping @ezimuel ; can you check this?

Also, for any who are experiencing the issue, how are you composing the BodyParamsMiddleware into your application? I have tested this in an API, where I have routes like the following:

$app->patch('/books/{id:' . $uuidRegex . '}', [
    Books\Middleware\AuthorizationMiddleware::class,
    Zend\Expressive\Helper\BodyParams\BodyParamsMiddleware::class,
    Books\Middleware\UpdateBookValidationMiddleware::class,
    Books\Middleware\UpdateBookMiddleware::class
]);

Note that this is:

  • a PATCH request
  • with a middleware pipeline in place
  • and the BodyParamsMiddleware is before the actual middleware to execute

This has been working perfectly for me on both v1 and v2 versions of Expressive. The content submitted is always parsed correctly and pushed into the request. My suspicion for those affected is that the middleware pipeline is not properly setup.

Copy link
Member

@geerteltink geerteltink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

What is the status on this? Can I merge it and close zendframework/zend-expressive#371?

@weierophinney
Copy link
Member Author

@xtreamwayz I'll merge today.

@weierophinney weierophinney merged commit 240e412 into zendframework:master Sep 11, 2017
weierophinney added a commit that referenced this pull request Sep 11, 2017
weierophinney added a commit that referenced this pull request Sep 11, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants