MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / test_request

Function test_request

src/http-util/src/lib.rs:277–284  ·  view source on GitHub ↗
(cors: &CorsLayer, origin: &HeaderValue)

Source from the content-addressed store, hash-verified

275 #[mz_ore::test(tokio::test)]
276 async fn test_cors() {
277 async fn test_request(cors: &CorsLayer, origin: &HeaderValue) -> Option<HeaderValue> {
278 let mut service = ServiceBuilder::new()
279 .layer(cors)
280 .service_fn(|_| async { Ok::<_, anyhow::Error>(Response::new("")) });
281 let request = Request::builder().header(ORIGIN, origin).body("").unwrap();
282 let response = service.ready().await.unwrap().call(request).await.unwrap();
283 response.headers().get(ACCESS_CONTROL_ALLOW_ORIGIN).cloned()
284 }
285
286 #[derive(Default)]
287 struct TestCase {

Callers 1

test_corsFunction · 0.85

Calls 8

layerMethod · 0.80
unwrapMethod · 0.80
bodyMethod · 0.45
headerMethod · 0.45
callMethod · 0.45
readyMethod · 0.45
getMethod · 0.45
headersMethod · 0.45

Tested by

no test coverage detected