webidl icon indicating copy to clipboard operation
webidl copied to clipboard

Consider renaming ByteString to HTTPHeaderString?

Open domenic opened this issue 4 years ago • 2 comments

The only places ByteString is used on the platform are:

  • XHR, Fetch, and Service Worker APIs dealing with HTTP headers
  • The return value of atob.

The latter could be easily converted to a DOMString (since it's a return value this has no change in semantics). And then we could do the proposed rename to make it clear when ByteString is reasonable to use on the web platform.

Thoughts?

domenic avatar Jun 03 '21 20:06 domenic

HTTPHeaderString could be a bit confusing. "\x04" is not a valid character in an HTTP header, but is a valid ByteString value.

TimothyGu avatar Jun 03 '21 22:06 TimothyGu

I think it's fine to use for all cases where you have a byte sequence and want to return it isomomorphic decoded for convenience. It's typically network APIs that need this as they never adopted Unicode.

E.g., I think https://w3c.github.io/resource-timing/#dom-performanceresourcetiming-nexthopprotocol should use it too. (Tracked in https://github.com/w3c/resource-timing/issues/274.)

annevk avatar Jun 04 '21 04:06 annevk