Types
Response = object httpVersion*: HttpVersion code*: HttpCode headers*: ResponseHeaders body*: string
- Response object. Source Edit
Procs
func htmlResponse(text: string; code = Http200; headers = initResponseHeaders(); version = HttpVer11): Response {.inline, ...raises: [], tags: [], forbids: [].}
- Content-Type: text/html; charset=UTF-8. Source Edit
func initResponse(httpVersion: HttpVersion; code: HttpCode; headers: openArray[(string, string)]; body = ""): Response {. inline, ...raises: [KeyError], tags: [], forbids: [].}
- Initializes a response. Source Edit
func initResponse(httpVersion: HttpVersion; code: HttpCode; headers = [ ("Content-Type", "text/html; charset=UTF-8")].initResponseHeaders; body = ""): Response {. inline, ...raises: [], tags: [], forbids: [].}
- Initializes a response. Source Edit
func jsonResponse(text: JsonNode; code = Http200; headers = initResponseHeaders(); version = HttpVer11): Response {. inline, ...raises: [], tags: [], forbids: [].}
- Content-Type: application/json. Source Edit
func plainTextResponse(text: string; code = Http200; headers = initResponseHeaders(); version = HttpVer11): Response {. inline, ...raises: [], tags: [], forbids: [].}
- Content-Type: text/plain. Source Edit
Templates
template deleteCookie(response: var Response; key: string; value = ""; path = ""; domain = "")
- Deletes the cookie of the response. Source Edit
template getHeaderOrDefault(response: Response; key: string; default = @[""]): seq[ string]
- Retrieves value of response.headers[key]. Otherwise default will be returned. Source Edit