erqwest
An experimental erlang wrapper for reqwest using rustler. Map-based interface inspired by katipo.
How it works
HTTP requests are performed asynchronously on a tokio
Runtime
and the responses returned as an erlang message.
Prerequisites
- Erlang/OTP
- Rust
- Openssl (not required on mac)
Or use the provided shell.nix
if you have nix installed.
Usage
Start a client
ok = erqwest:start_client(default).
This registers a client under the name default
. The client maintains an
internal connection pool.
Synchronous interface
{ok, #{status := 200}} = erqwest:get(default, <<"https://httpbin.org/get">>).
Asynchronous interface
ok = erqwest:req_async(default, self(), Ref=make_ref(), #{method => get, url => <<"https://httpbin.org/get">>}).
receive
{erqwest_response, Ref, {ok, #{status := 200}}} -> ok
end.
Docs
Benchmarks
Todo
- Shut down tokio event loop cleanly
- Test thoroughly