No matching definitions.

http/response

src/http/response.tur
defn

response-status

(response-status [resp :int] :int)

HTTP status code of a response.

resp:int response handle (unwrapped ok-val)

:int -- HTTP status code (e.g. 200, 404)

(response-status resp)  ; => 200

Since: P5

defn

response-header

(response-header [resp :int name :cstr] :cstr)

look up a response header by name (case-insensitive).

resp:int response handle
nameheader name, e.g. "Content-Type"

:cstr -- header value, or "" if not found

(response-header resp "Content-Type")

Since: P5

defn

response-body

(response-body [resp :int] :cstr)

raw body string of a response.

resp:int response handle

:cstr -- NUL-terminated response body

(println (response-body resp))

Since: P5

defn

response-json

(response-json [resp :int] :ptr<void>)

parse the response body as JSON, returning a doc handle.

resp:int response handle

result<:int> -- ok(doc-handle) or err(:cstr message). Use json-emit / json-get-in from json/emit and json/patch to inspect.

(let [jr (response-json resp)]
    (when (ok? jr) (json-get-in (ok-val jr) "data.id")))

Since: P5