Re: [whatwg/fetch] Support Structured Field Values in the Headers API (#930)

@annevk ... I'd like to see if we can revive this a bit. Having structured header (https://datatracker.ietf.org/doc/html/rfc8941) support in `Headers` would be useful. I do think we might be able to keep it simple by not messing around the with the `set`/`append`/`get` methods and instead focus on introducing new statics on `Headers` that only deal with the serialization/deserialization.

```js
h = new Headers();
h.set('abc', Headers.fromItem('a'));
h.set('xyz', Headers.fromList([1,2,3]);
h.set('foo', Headers.fromDictionary(...);

Headers.toDictionary(h.get('foo'));
// etc
```

The idea here would be to introduce six new static methods on `Headers` whose purpose to only to serialize/deserialize the structured header syntax:

* `Headers.fromItem(...)`
* `Headers.fromList(...)`
* `Headers.fromDict(...)`
* `Headers.toItem(...)`
* `Headers.toList(...)`
* `Headers.toDict(...)`



-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/930#issuecomment-2045589619
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/fetch/issues/930/2045589619@github.com>

Received on Tuesday, 9 April 2024 16:18:22 UTC