godottpd

HttpResponse

Extends: Reference

Description

A response object useful to send out responses

Property Descriptions

client

var client: StreamPeer

The client currently talking to the server

server_identifier

var server_identifier: String = "GodotTPD"

The server identifier to use on responses [GodotTPD]

headers

var headers: Dictionary

A dictionary of headers Headers can be set using the set(name, value) function

cookies

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

Method Descriptions

send_raw

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

Parameters

send

func send(status_code: int, data: String = "", content_type = "text/html") -> void

Send out a response to the client

Parameters

json

func json(status_code: int, data) -> void

Send out a JSON response to the client This function will internally call the send() method

Parameters

set

func set(field: String, value: String) -> void

Sets the response’s header “field” to “value”

Parameters

func cookie(name: String, value: String, options: Dictionary) -> void

Sets cookie “name” to “value”

Parameters