| 2 | |
| 3 | #[test_log::test] |
| 4 | fn 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 | } |