Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception when body is empty #13

Open
whites11 opened this issue Sep 21, 2018 · 1 comment
Open

Exception when body is empty #13

whites11 opened this issue Sep 21, 2018 · 1 comment

Comments

@whites11
Copy link

I am using this project to check the correctness of the query string parameters of a PUT call which is body-less by design.
I understand this is an edge case, but this is throwing an exception.

ZE\ContentValidation\Exception\UnexpectedValueException: Data Extractor `ZE\ContentValidation\Extractor\BodyExtractor` returned a `NULL` instead of an `array`
 in: /app/src/vendor/mvlabs/ze-content-validation/src/Extractor/DataExtractorChain.php: 54
#0 [internal function]: ZE\ContentValidation\Extractor\DataExtractorChain->ZE\ContentValidation\Extractor\{closure}(Object(ZE\ContentValidation\Extractor\BodyExtractor))
#1 /app/src/vendor/mvlabs/ze-content-validation/src/Extractor/DataExtractorChain.php(64): array_map(Object(Closure), Array)
#2 /app/src/vendor/mvlabs/ze-content-validation/src/Validator/ValidatorHandler.php(71): ZE\ContentValidation\Extractor\DataExtractorChain->getDataFromRequest(Object(Zend\Diactoros\ServerRequest))
#3 /app/src/vendor/mvlabs/ze-content-validation/src/Middleware/ValidationMiddleware.php(53): ZE\ContentValidation\Validator\ValidatorHandler->validate(Object(Zend\Diactoros\ServerRequest))
#4 /app/src/vendor/zendframework/zend-expressive/src/Middleware/LazyLoadingMiddleware.php(60): 

Maybe it would make sense to treath the "null" case as a special case returning an empty array in the BodyExtractor class

@jguittard
Copy link

Why would a PUT call would be body less by design ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants