Extends: Reference
A response object useful to send out responses
var client: StreamPeer
The client currently talking to the server
var server_identifier: String = "GodotTPD"
The server identifier to use on responses [GodotTPD]
var headers: Dictionary
A dictionary of headers
Headers can be set using the set(name, value)
function
var cookies: Array
An array of cookies
Cookies can be set using the cookie(name, value, options)
function
Cookies will be automatically sent via “Set-Cookie” headers to clients
func send_raw(status_code: int, data: PoolByteArray, content_type: String = "application/octet-stream") -> void
Send out a raw (Bytes) response to the client Useful to send files faster or raw data which will be converted by the client
func send(status_code: int, data: String = "", content_type = "text/html") -> void
Send out a response to the client
func json(status_code: int, data) -> void
Send out a JSON response to the client
This function will internally call the send()
method
func set(field: String, value: String) -> void
Sets the response’s header “field” to “value”
func cookie(name: String, value: String, options: Dictionary) -> void
Sets cookie “name” to “value”