Skip to content

Commit

Permalink
documentation for handle headers already sent
Browse files Browse the repository at this point in the history
Signed-off-by: Abdul Malik Ikhsan <samsonasik@gmail.com>
  • Loading branch information
samsonasik committed Aug 12, 2020
1 parent 77ae913 commit d059311
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions docs/book/response.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,16 @@ $response->setContent(<<<EOS
</html>
EOS);
```

### handle Headers already sent

Since 2.13.0, we can handle header already sent by pass callable via `Response::setHeadersSentHandler()`:

```php
use Laminas\Http\Response;

$response = new Response();
$response->setHeadersSentHandler(function ($response): void {
throw new RuntimeException('Cannot send headers, headers already sent');
});
```

0 comments on commit d059311

Please sign in to comment.