Skip to main content

Class: ExpressHttpResponse

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 ExpressHttpResponse(response): ExpressHttpResponse

Parameters​

response​

Response

Returns​

ExpressHttpResponse

Methods​

clearCookie()​

clearCookie(name, options?): this

Parameters​

name​

string

options?​

CookieOptions

Returns​

this

Implementation of​

HttpResponse.clearCookie


cookie(name, value, options?): this

Parameters​

name​

string

value​

string

options?​

CookieOptions

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?​

any

Returns​

void

Implementation of​

HttpResponse.json


send()​

send(body?): void

Parameters​

body?​

any

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