- From: Evert Pot <me@evertpot.com>
- Date: Mon, 29 Jan 2024 11:52:49 -0500
- To: "ietf-http-wg@w3.org" <ietf-http-wg@w3.org>
- Message-ID: <20c4637d-1aca-438d-b463-747f56b07fb3@evertpot.com>
Hi!
Just wanted to share I updated my Javascript implementation to the
latest Structured Fields draft:
https://www.npmjs.com/package/structured-headers
(released with an alpha tag until the RFC is published).
Bit annoying I called it 'structured headers', but I'm kind of stuck
with that now. I've shared these in the past, but there's 2 slight
incompatibilities with the spec that might be interesting for the authors.
1. Javascript can't differentiate between |1.0| and |1|. As a result
we're skipping the tests that require a serialiation output of |1.0|.
2. Javascript rounds slightly different from the spec. The tests
suggest that |0.0025| should round to the nearest event number
(|0.002|), but Javascript rounds to |0.003|.
Just wanted to share this as a data point. It would be possible to wrap
every number in a class that labels it as decimal or int, but this would
reduce the ergonomics of the standard use-case quite a bit.
The library has quite a bit of downloads (400K / week), which surprised
me. So if people will be reaching to this when they want to
serialize/parse Structured headers I would like to be a good citizen, so
I'm open for any feedback.
The one thing I will change before a 2.0 release is that I intend to
ship a `Dictionary` wrapper. v1 returns a deep structure with simple
arrays and Maps, and I think it's a bit frustrating to work with for
simple use-cases.
Evert
Received on Monday, 29 January 2024 16:52:59 UTC