Conditions | 2 |
Paths | 2 |
Total Lines | 13 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
35 | 1 | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
|
36 | { |
||
37 | // https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Encoding |
||
38 | 1 | if ($request->getHeaderLine('Content-Encoding') === 'base64') { |
|
39 | 1 | $resource = $request->getBody()->detach(); |
|
40 | // https://www.php.net/manual/en/filters.convert.php |
||
41 | 1 | \stream_filter_append($resource, 'convert.base64-decode'); |
|
42 | |||
43 | 1 | $body = $this->streamFactory->createStreamFromResource($resource); |
|
44 | 1 | $request = $request->withBody($body); |
|
45 | } |
||
46 | |||
47 | 1 | return $handler->handle($request); |
|
48 | } |
||
50 |