Version 4.7.6
This commit is contained in:
1 parent
8ba7d43898
commit
7b7404e741
1085 files changed
+30590
-7837
No files matched your search
+21
-3
@@ -559,10 +559,12 @@ class Helper
|
||||
);
|
||||
}
|
||||
} else {
|
||||
parse_str((string) $request->getBody(), $bodyParams);
|
||||
if ($request instanceof ServerRequestInterface) {
|
||||
$bodyParams = $request->getParsedBody();
|
||||
}
|
||||
|
||||
if (! is_array($bodyParams)) {
|
||||
throw new RequestError('Unexpected content type: ' . Utils::printSafeJson($contentType[0]));
|
||||
if (! isset($bodyParams)) {
|
||||
$bodyParams = $this->decodeContent((string) $request->getBody(), $contentType[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -576,6 +578,22 @@ class Helper
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*
|
||||
* @throws RequestError
|
||||
*/
|
||||
protected function decodeContent(string $rawBody, string $contentType) : array
|
||||
{
|
||||
parse_str($rawBody, $bodyParams);
|
||||
|
||||
if (! is_array($bodyParams)) {
|
||||
throw new RequestError('Unexpected content type: ' . Utils::printSafeJson($contentType));
|
||||
}
|
||||
|
||||
return $bodyParams;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts query execution result to PSR-7 response
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user