(header_map: &HeaderMap)
| 16 | } |
| 17 | |
| 18 | pub(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 | } |
no outgoing calls
no test coverage detected