EmptyResponse - viames/pair GitHub Wiki
Pair framework: EmptyResponse
Pair\Http\EmptyResponse is an explicit response object for status-only responses.
It sends configured headers and an HTTP status code without emitting a body.
Constructor
new EmptyResponse(int $httpCode = 204, array $headers = [])
Arguments:
httpCode: HTTP status code.headers: additional response headers keyed by header name.
Example:
use Pair\Http\EmptyResponse;
return new EmptyResponse(304, [
'ETag' => '"abc123"',
'Cache-Control' => 'public, max-age=300',
]);
Typical use
EmptyResponse is mainly used by HttpCache for 304 Not Modified responses.
Use JsonResponse or TextResponse when the endpoint has a response body.
When APP_DEBUG=true and observability debug headers are enabled, send() also emits Pair correlation and trace timing headers.
See also: HttpCache, JsonResponse, TextResponse, Observability, ResponseInterface.