Repository navigation
feat: refuse an array with keys as a body, and release 1.2.0 - #14
Merged
Merged
Conversation
An array with keys as a body went out as its values without the keys. new Response() now throws a ValueError that names json_encode(). More messages name the way out, from the review of 1.1.0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Release 1.2.0, in one PR:
new Response()throws aValueErrorfor an array with keys as a body. Before, such a body wentout as a stream of its values without the keys:
['ok' => 'yes', 'user' => 'Ada']sentyesAda.The message names
json_encode($data).tick()orclose()from a handlerRequestResponseend of the message of a body that
close()cut.ValueError; the CHANGELOG has the section 1.2.0.Why
The review by eight roles of 1.1.0 found these as the last points of the AI-agent developer: a
coding agent with Laravel habits passes an array as a body, and a test that checks only the status
passes while the browser gets
yesAda. In scope: "The status, the headers, the body and theframing of a response".
Tests
New cases in
Handlerfor a handler that returns an array or an object, and for an array withkeys as a body; the tests that quote the messages follow them. macOS, PHP 8.5: 636 tests passed;
Pint, Rector, PHPStan clean, type coverage 100 %.
composer testin Docker on Debian (PHP 8.4)and Alpine (PHP 8.5, locked and newest), on arm64 and amd64, coverage and mutation of
src/Response.phpandsrc/Request.php: running; this PR is merged only after them.