Repository navigation
v3.0.2
A single batch can now safely mix sub-requests that return any
Content-Type (JSON, problem+json, vendor +json, HTML, text, XML/SVG,
PDF, PNG, octet-stream, BinaryFileResponse, StreamedResponse, 204).
Previously binary bodies corrupted the outer JsonResponse envelope and
BinaryFileResponse/StreamedResponse payloads were silently dropped.
Changes
-
New
Lemric\BatchRequest\Bridge\ResponseFormatter(framework-agnostic,
shared by both bridges — works for Laravel too because
Illuminate\Http\Responseextends Symfony's and Laravel reuses
Symfony'sBinaryFileResponse/StreamedResponse).- JSON /
*/*+json→ decoded array. - text/* and
application/{xml,*+xml,javascript,yaml,…}→ raw string. - Anything else → base64-encoded body +
body_encoding: "base64". BinaryFileResponsematerialised viagetFile().StreamedResponsecaptured via output buffering.- Malformed JSON with a JSON content type stays as raw string
(server claimed text, no base64). - Empty/no-content responses return
""(consistent string typing).
- JSON /
-
Symfony/SymfonyTransactionExecutorand
Laravel/LaravelTransactionExecutordelegate response shaping to the
new formatter; duplicatedformatResponse/extractHeaders/
isJsonContentTyperemoved. -
README: new "Mixed content types in a single batch" section with the
Content-Type → body-shape table and an example mixed response.
Tests
- New
tests/Bridge/ResponseFormatterTest.php(17 cases) covers every
branch and a mixed-batch round-trip throughjson_encode. - New
tests/Bridge/ResponseFormatterLaravelTest.php(9 cases) proves
the formatter handlesIlluminate\Http\{Response,JsonResponse}and
SymfonyBinaryFileResponse/StreamedResponsereturned by Laravel
helpers. SymfonyTransactionExecutorTest::testExecuteHandlesResponseWithoutContent
updated: empty body is now""instead of[].