- Added basic handling of BODY content from Web-RestMethod from PS
This commit is contained in:
parent
83fee32ac0
commit
ceebc6783a
|
@ -25,16 +25,24 @@ class FormContext implements FormContextInterface
|
|||
|
||||
public ? ResponseInterface $response = null;
|
||||
|
||||
public function __construct(ServerRequestInterface $request, ? string $formName = null)
|
||||
public function __construct(ServerRequestInterface $request, ? string $formName = null)
|
||||
{
|
||||
$this->request = $request;
|
||||
|
||||
|
||||
if ( $formName ) {
|
||||
$this->formName = $formName;
|
||||
$this->formName = $formName;
|
||||
}
|
||||
|
||||
|
||||
$this->values = $request->getParsedBody() ?: [];
|
||||
|
||||
if ( ! $this->values ) {
|
||||
$content = utf8_encode((string) $request->getBody());
|
||||
|
||||
if ( $content && ( $json = json_decode($content, true) ) ) {
|
||||
$this->values = $json;
|
||||
}
|
||||
}
|
||||
|
||||
$this->files = $request->getUploadedFiles() ?: [];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue