We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5638731 commit 939cda5Copy full SHA for 939cda5
src/HttpClientMock/MockRequestBuilderFactory.php
@@ -57,13 +57,14 @@ private function processBody(
57
array $headers,
58
): void {
59
$contentType = (string) $mockRequestBuilder->getHeader('Content-Type');
60
+ $contentLength = $mockRequestBuilder->getHeader('Content-Length') ?? 0;
61
62
// application/json; charset=utf-8
63
if (strpos($contentType, 'application/json') === 0) {
64
if (is_string($body)) {
65
$mockRequestBuilder->json(json_decode($body, true));
66
} elseif (is_callable($body)) {
- $mockRequestBuilder->json(json_decode((string) $body(), true));
67
+ $mockRequestBuilder->json(json_decode((string) $body((int) $contentLength), true));
68
} elseif (is_array($body)) {
69
$mockRequestBuilder->json($body);
70
} else {
0 commit comments