MCPcopy Create free account
hub / github.com/bytecodealliance/wstd / http_server_proxy

Function http_server_proxy

test-programs/tests/http_server_proxy.rs:4–20  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2
3#[test_log::test]
4fn http_server_proxy() -> Result<()> {
5 // Run wasmtime serve for the proxy and the target HTTP server.
6 let _serve_target = test_programs::WasmtimeServe::new(test_programs::HTTP_SERVER)?;
7 let _serve_proxy = test_programs::WasmtimeServe::new_with_config(
8 test_programs::HTTP_SERVER_PROXY,
9 8082,
10 &["TARGET_URL=http://127.0.0.1:8081"],
11 )?;
12
13 // TEST / of the `http_server` example through the proxy
14 let body: String = ureq::get("http://127.0.0.1:8082/proxy/")
15 .call()?
16 .body_mut()
17 .read_to_string()?;
18 assert_eq!(body, "Hello, wasi:http/proxy world!\n");
19 Ok(())
20}

Callers

nothing calls this directly

Calls 1

getFunction · 0.85

Tested by

no test coverage detected