http_req_wasi 0.10.1

HTTP client for the WasmEdge network socket API. Derived from the http_req library.
docs.rs failed to build http_req_wasi-0.10.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: http_req_wasi-0.11.1

http_req_wasi

Simple and lightweight HTTP client for the low level wasmedge_wasi_socket library. It is to be compiled into WebAssembly bytecode targets and runs in the WasmEdge Runtime as a lightweight and secure alternative to natively compiled apps in Linux container.

This project is forked and derived from the http_req project created by jayjamesjay.

Example

Basic GET request

use http_req::request;

fn main() {
    let mut writer = Vec::new(); //container for body of a response
    let res = request::get("http://eu.httpbin.org/get?msg=WasmEdge", &mut writer).unwrap();

    println!("Status: {} {}", res.status_code(), res.reason());
    println!("Headers {}", res.headers());
    println!("{}", String::from_utf8_lossy(&writer));
}

How to use:

[dependencies]
http_req_wasi  = "0.10"

HTTPS support

The HTTP and HTTPS APIs are the same. But you will need to get the WasmEdge https_req plugin and unzip it into the plugin directory of your WasmEdge install.

See examples here.