Skip to main content

dispatch_http_call

Function dispatch_http_call 

Source
pub fn dispatch_http_call<K1, V1, K2, V2, B>(
    upstream: &str,
    headers: &[(K1, V1)],
    body: Option<B>,
    trailers: &[(K2, V2)],
    timeout: Duration,
) -> Result<u32>
where K1: AsRef<[u8]>, V1: AsRef<[u8]>, K2: AsRef<[u8]>, V2: AsRef<[u8]>, B: AsRef<[u8]>,
Expand description

Dispatches an HTTP call to a given upstream.

ยงExamples

use std::time::Duration;
use proxy_wasm::hostcalls;

let request_handle = hostcalls::dispatch_http_call(
    "cluster_name",
    &vec![
        (":method", "POST"),
        (":path", "/stuff"),
    ],
    Some("hi there!"),
    hostcalls::NO_TRAILERS,
    Duration::from_secs(10),
)?;