#http-client #wasm-edge #http-request #http #request #client #wasm

wasmedge_http_req

HTTP client for the WasmEdge network socket API. Derived from the http_req library.

2 unstable releases

0.9.0 May 18, 2022
0.8.1 Oct 6, 2021

#13 in #wasm-edge


Used in wasmedge_quickjs

MIT license

110KB
2K SLoC

wasmedge_http_req

Simple and lightweight HTTP client for the low level wasmedge_wasi_socket library. It is to be compiled into WebAssembly bytecode targets and run on the WasmEdge Runtime.

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

Example

Basic GET request

use wasmedge_http_req::request;

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

    println!("Status: {} {}", res.status_code(), res.reason());
}

How to use:

[dependencies]
wasmedge_http_req  = "0.8.1"

lib.rs:

Simple HTTP client with built-in HTTPS support. Currently it's in heavy development and may frequently change.

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("https://doc.rust-lang.org/", &mut writer).unwrap();

    println!("Status: {} {}", res.status_code(), res.reason());
}

Dependencies

~205KB