No matching definitions.

http/request

src/http/request.tur
defn

request

(request [method : cstr url : cstr body : cstr headers : int] :)

create an HTTP request handle.

methodHTTP method string ("GET", "POST", ...)
urlfull URL including scheme, e.g. "https://example.com/api"
bodyrequest body string ("" for no body)
headerscons-list of alternating header-name / header-value strings.
Pass (nil-value) for no extra headers.

:int -- opaque request handle; pass to http-request

(let [req (request "GET" "https://example.com" "" (nil-value))]
    (http-request req))

Since: P5

defn

json-request

(json-request [^EncodeJson T method : cstr url : cstr x : T headers : int] :)
defn

request-free

(request-free [req : int] :)

release a request record built by request / json-request.

reqrequest handle

:void

(let [req (request "GET" "http://127.0.0.1:8080/" "" 0)
        r   (http-request req)]
    (request-free req)
    (http-result-free r))

Since: 0.2.0

Internal definitions
__cstr-free-- release a malloc'd JSON fragment returned by `encode-json`.
__hdr-cons-- prepend a `key`/`val` header pair onto a header cons-list.
__req-own-cells!-- build an HTTP request whose body is `x` encoded as JSON,