Response builder
Last updated
Last updated
[io/http/server/utils/Response builder]
Builds a response structure out of its components: HTTP status, headers, and body. Example:
200@1 received via status
{"Content-Type": "text/plain"}@1 received via headers
"OK"@1 received via body
{"status": 200, "headers": {"Content-Type": "text/plain"}, "body": "OK"}@1 sent via response
Keywords: construct, build, response, http, API, text, REST
body: string
Receives the body of the response. Example: "OK"
status: number
Receives a HTTP status code. Example: 200
headers: {string: string}
Receives a record of HTTP headers. Example: {"Contanet-Type": "text/plain"}
response:
Sends the constructed HTTP response.