| Conditions | 3 |
| Paths | 3 |
| Total Lines | 17 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 19 | public function handleRequest(RequestInterface $request, callable $next, callable $first) |
||
| 20 | { |
||
| 21 | if (!$request->hasHeader('Content-Length')) { |
||
| 22 | $stream = $request->getBody(); |
||
| 23 | |||
| 24 | // Cannot determine the size so we use a chunk stream |
||
| 25 | if (null === $stream->getSize()) { |
||
| 26 | $stream = new ChunkStream($stream); |
||
| 27 | $request = $request->withBody($stream); |
||
| 28 | $request = $request->withAddedHeader('Transfer-Encoding', 'chunked'); |
||
| 29 | } else { |
||
| 30 | $request = $request->withHeader('Content-Length', $stream->getSize()); |
||
| 31 | } |
||
| 32 | } |
||
| 33 | |||
| 34 | return $next($request); |
||
| 35 | } |
||
| 36 | } |
||
| 37 |