Skip to main content

Class: FastifyHttpResponse

Represents an HTTP response, providing methods to set status codes, headers, cookies, and send various types of responses such as JSON, files, or streams. Also includes methods to clear cookies and check if the response has been committed.

Implements​

Constructors​

Constructor​

new FastifyHttpResponse(response): FastifyHttpResponse

Parameters​

response​

FastifyReply

Returns​

FastifyHttpResponse

Methods​

clearCookie()​

clearCookie(name, options?): this

Parameters​

name​

string

options?​

SerializeOptions

Returns​

this

Implementation of​

HttpResponse.clearCookie


cookie(name, value, options?): this

Parameters​

name​

string

value​

string

options?​

SerializeOptions

Returns​

this

Implementation of​

HttpResponse.cookie


end()​

end(): void

Returns​

void

Implementation of​

HttpResponse.end


file()​

file(filePath): void

Parameters​

filePath​

string

Returns​

void

Implementation of​

HttpResponse.file


header(name, value): this

Parameters​

name​

string

value​

string

Returns​

this

Implementation of​

HttpResponse.header


isCommitted()​

isCommitted(): boolean

Returns​

boolean

Implementation of​

HttpResponse.isCommitted


json()​

json(body?): void

Parameters​

body?​

unknown

Returns​

void

Implementation of​

HttpResponse.json


send()​

send(body?): void

Parameters​

body?​

unknown

Returns​

void

Implementation of​

HttpResponse.send


status()​

status(code): this

Parameters​

code​

number

Returns​

this

Implementation of​

HttpResponse.status


stream()​

stream(stream): void

Parameters​

stream​

ReadableStream

Returns​

void

Implementation of​

HttpResponse.stream