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

Function header_map_to_wasi

src/http/fields.rs:18–27  ·  view source on GitHub ↗
(header_map: &HeaderMap)

Source from the content-addressed store, hash-verified

16}
17
18pub(crate) fn header_map_to_wasi(header_map: &HeaderMap) -> Result<Fields, Error> {
19 let wasi_fields = Fields::new();
20 for (key, value) in header_map {
21 // Unwrap because `HeaderMap` has already validated the headers.
22 wasi_fields
23 .append(key.as_str(), value.as_bytes())
24 .with_context(|| format!("wasi rejected header `{key}: {value:?}`"))?
25 }
26 Ok(wasi_fields)
27}

Callers 3

try_into_outgoingFunction · 0.85
respondMethod · 0.85
sendMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected