http v0.2.2

HTTP client library

README


HTTP

An HTTP client library for umka. It works both on Linux and Windows using libcurl. Install using PAK.

License

See LICENSE in the repo root.

Example

import (
    "pak/http/http.um"
)

fn main() {
    resp := http.get(
        http.encodeUrl("http://httpbin.org/get", {
            "foo": "bar",
            "baz": 42
        }),
        {
            userAgent: "my user agent"
        }
    )

    printf("Ok: %v\n", resp.ok)
    printf("Error: %v\n", resp.err)
    printf("Code: %v\n", resp.status)
    printf("Content type: %v\n", resp.contentType)
    printf("Body: %v\n", str([]char(resp.body)))

    resp = http.post(
        "http://httpbin.org/post",
        "Hello, world!",
        {
            userAgent: "my user agent"
        }
    )

    printf("Ok: %v\n", resp.ok)
    printf("Error: %v\n", resp.err)
    printf("Code: %v\n", resp.status)
    printf("Content type: %v\n", resp.contentType)
    printf("Body: %v\n", str([]char(resp.body)))
}

Homepage

Documentation

License: Unlicense/MIT

Download count: 13


To add this package to your project run:

umbox install http

Or download as a tar.


Dependencies

Last updated

2024-02-23T17:09:19