MCPcopy Create free account
hub / github.com/awslabs/llrt / apply_default_headers

Function apply_default_headers

modules/llrt_fetch/src/fetch.rs:420–436  ·  view source on GitHub ↗
(
    req: &mut hyper::http::request::Builder,
    detected_headers: &HashSet<&str>,
)

Source from the content-addressed store, hash-verified

418 headers,
419 body,
420 &response_status,
421 initial_uri,
422 )?;
423
424 let res = dispatch(ctx, client, req, abort_receiver).await?;
425
426 let status = res.status();
427
428 // Per WHATWG Fetch §4.5 step 15.4: 421 on a non-GET/HEAD request retries once on a fresh connection.
429 if status.as_u16() == 421 && !matches!(method, Method::GET | Method::HEAD) {
430 drop(res);
431 // Force a new connection: open a new hyper client whose pool can't share TCP conns with the global one.
432 let new_client = llrt_http::build_client(None)
433 .or_throw_type(ctx, "Fetch failed: could not build retry client")?;
434 let (req, _) = build_request(
435 ctx,
436 &method,
437 uri,
438 headers,
439 body,

Callers 2

send_streamFunction · 0.85
build_requestFunction · 0.85

Calls 2

concatMethod · 0.80
as_strMethod · 0.45

Tested by

no test coverage detected