BQN HTTP library, from libcurl FFI bindings
Find a file
2023-10-01 19:17:17 +02:00
config.bqn Initial commit: GET requests 2023-10-01 17:01:26 +02:00
curl.bqn Refactor error handling 2023-10-01 18:38:45 +02:00
ffi.bqn Rename options→curlOptions, info→curlInfo 2023-10-01 17:51:09 +02:00
LICENSE Add license and readme 2023-10-01 19:17:17 +02:00
README.org Add license and readme 2023-10-01 19:17:17 +02:00
test.bqn Refactor GET and POST requests 2023-10-01 18:14:54 +02:00
utils.bqn Initial commit: GET requests 2023-10-01 17:01:26 +02:00

BQN HTTP library

FFI bindings to libcurl for BQN.

Making requests

Only GET and POST requests are implemented at this time.

Get,Post•Import"curl.bqn"

Simple GET requests:

rGet"https://httpbin.org/get"

You can pass headers as a left argument:

r"Content-Type: application/json"Get"https://httpbin.org/get"

Arguments, port number, etc, can be included in the URL.

For POST requests, pass data as an additional string parameter. It will not be converted or encoded in any way.

r"Content-Type: application/json"Post"https://httpbin.org/post""{""key"": ""value""}"

Response objects

The response object is a namespace with the following elements:

  • code: the response code.
  • headers: the response headers as a single string, separated by newlines.
  • content: the response content, as raw bytes.
  • time: the time the request took, in seconds.

If your endpoint returns text, you can use FromBytes from bqn-libs/strings.bqn to decode UTF-8.