Skip to content

feat: refuse an array with keys as a body, and release 1.2.0 - #14

Merged
sorge-it merged 1 commit into
mainfrom
feat/release-1.2.0
Nov 22, 2026
Merged

sorge-it merged 1 commit into
mainfrom
feat/release-1.2.0

Conversation

@sorge-it

Copy link
Copy Markdown
Owner

What

Release 1.2.0, in one PR:

  • new Response() throws a ValueError for an array with keys as a body. Before, such a body went
    out as a stream of its values without the keys: ['ok' => 'yes', 'user' => 'Ada'] sent yesAda.
    The message names json_encode($data).
  • Messages name the way out:
Case Adds
a handler returns a string "Wrap it: new Response(200, [], $body)."
a handler returns an array "For JSON, return new Response(200, ['Content-Type' => 'application/json'], json_encode($data))."
tick() or close() from a handler "Return from the handler, and call tick() and close() from the test."
the headers of Request "map each lowercase name to a list of values, such as ['content-type' => ['text/plain']]"
an integer key in the headers of Response "map each name to its value, such as ['X-Foo' => 'bar']"
  • "The handler returned …" instead of "gave", "The streamed body yielded …", and the period at the
    end of the message of a body that close() cut.
  • The README names the new 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 the
framing of a response".

Tests

New cases in Handler for a handler that returns an array or an object, and for an array with
keys 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 test in Docker on Debian (PHP 8.4)
and Alpine (PHP 8.5, locked and newest), on arm64 and amd64, coverage and mutation of
src/Response.php and src/Request.php: running; this PR is merged only after them.

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.
@sorge-it
sorge-it marked this pull request as ready for review November 22, 2026 13:06
@sorge-it
sorge-it merged commit 2ee8235 into main Nov 22, 2026
14 checks passed
@sorge-it
sorge-it deleted the feat/release-1.2.0 branch November 22, 2026 13:06
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

Successfully merging this pull request may close these issues.

1 participant