Skip to content

Commit 886e61a

Browse files
authored
Delete outdated XML and JSON payloads reading section
The 5.x alternative of using the body parser middleware is already mentioned in the "Request Body Data" section.
1 parent 9226365 commit 886e61a

File tree

1 file changed

+0
-24
lines changed

1 file changed

+0
-24
lines changed

docs/en/controllers/request-response.md

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -327,30 +327,6 @@ a setter for environment variables without having to modify globals
327327
$this->request->withEnv('REQUEST_METHOD', 'POST');
328328
```
329329

330-
### Reading XML and JSON Payloads
331-
332-
Applications employing [REST](../development/rest) often exchange data in
333-
non-URL-encoded post bodies. You can read input data in any format using
334-
`Cake\Http\ServerRequest::input()`. By providing a decoding function,
335-
you can receive the content in a deserialized format:
336-
337-
Some deserializing methods require additional parameters when called, such as
338-
the 'as array' parameter on `json_decode`. If you want XML converted into a
339-
DOMDocument object, `Cake\Http\ServerRequest::input()` supports
340-
passing additional parameters as well:
341-
342-
::: code-group
343-
344-
```php [JSON]
345-
// Get JSON-encoded data submitted to a PUT/POST action
346-
$jsonData = $this->request->input('json_decode');
347-
```
348-
349-
```php [XML]
350-
// Get XML-encoded data submitted to a PUT/POST action
351-
$data = $this->request->input('Cake\Utility\Xml::build', ['return' => 'domdocument']);
352-
```
353-
354330
:::
355331

356332
### Path Information

0 commit comments

Comments
 (0)