-
Notifications
You must be signed in to change notification settings - Fork 2
EmptyResponse
Viames Marino edited this page Apr 22, 2026
·
1 revision
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.
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',
]);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.