Conditions | 4 |
Paths | 4 |
Total Lines | 16 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
27 | public function process(ServerRequestInterface $request, DelegateInterface $delegate) |
||
28 | { |
||
29 | $headers = $request->getHeader('content-type'); |
||
30 | foreach ($headers as $header) { |
||
31 | if ('application/json' === substr($header, 0, 16)) { |
||
32 | $request->getBody()->rewind(); |
||
33 | $body = $request->getBody()->getContents(); |
||
34 | $json = json_decode($body, true); |
||
35 | if (is_array($json)) { |
||
36 | $request = $request->withParsedBody($json); |
||
37 | } |
||
38 | } |
||
39 | } |
||
40 | |||
41 | return $delegate->process($request); |
||
42 | } |
||
43 | } |
||
44 |