-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
bugIncorrect behavior in the current implementation that needs fixingIncorrect behavior in the current implementation that needs fixingwasi:implIssues pertaining to WASI implementation in WasmtimeIssues pertaining to WASI implementation in Wasmtime
Description
Consider the spec for wasi:http/fields#copy-all:
/// Retrieve the full set of names and values in the Fields. Like the
/// constructor, the list represents each name-value pair.
///
/// The outer list represents each name-value pair in the Fields. Names
/// which have multiple values are represented by multiple entries in this
/// list with the same name.
///
/// The names and values are always returned in the original casing and in
/// the order in which they will be serialized for transport.
copy-all: func() -> list<tuple<field-name, field-value>>;
However, Wasmtime does not preserve case. If I add a field named "Foo", and then I copy_all
, the field name that I get is "foo"
.
extern crate wit_bindgen;
wit_bindgen::generate!({
inline: r"
package test:test;
world test {
include wasi:http/[email protected];
}
",
additional_derives: [PartialEq, Eq, Hash, Clone],
features:["clocks-timezone"],
generate_all
});
use wasi::http::types::Fields;
fn test_valid_field_name(field: &str) {
let fields = Fields::new();
assert!(!fields.has(field));
fields.set(field, &[b"val".to_vec()]).unwrap();
assert_eq!(fields.copy_all(),
[(field.to_string(), b"val".to_vec())]);
}
fn test_valid_field_names() {
test_valid_field_name("Foo");
}
fn main() {
test_valid_field_names();
}
thread 'main' (1) panicked at src/bin/field-capitalization.rs:22:5:
assertion `left == right` failed
left: [("foo", [118, 97, 108])]
right: [("Foo", [118, 97, 108])]
Metadata
Metadata
Assignees
Labels
bugIncorrect behavior in the current implementation that needs fixingIncorrect behavior in the current implementation that needs fixingwasi:implIssues pertaining to WASI implementation in WasmtimeIssues pertaining to WASI implementation in Wasmtime