Open liamcurry opened 5 years ago
The Web IDL for Headers#set
takes a ByteString
which is "the set of all possible sequences of bytes", so yes it seems we should allow passing arbitrary slices here.
However, we translate ByteString
to &str
in our Web IDL frontend. I can't remember if there is a particular reason for that, or if this is just an oversight. +cc @alexcrichton
This was configured in https://github.com/rustwasm/wasm-bindgen/pull/511 and was intended to match the documentation at https://developer.mozilla.org/en-US/docs/Web/API/ByteString. This may be a WebIDL/JS mismatch?
One thing we could do, if JS supports it, is also generate methods taking Uint8Array
if a ByteString
is accepted
I'm writing some code to convert an
http::Request
to aweb_sys::Request
, and I noticed in thehttp
crate there is a structHeaderValue
with this note:The functions for
web_sys::Headers
don't take this into account and all rely on strings. Would that be considered a bug? If not then please feel welcome to close this issue. Thanks!