Open Jxck opened 3 months ago
Hi @Jxck !
It's very interesting, and your library seems very good. If we implement it, we will add the feature to c.header()
. I'll try to investigate the SFV more. Thanks.
Hi @yusukebe
What do you think about implementing structured field values (SFV) following the RFC 8941 for our headers? It could streamline our communication, making it more standardized and efficient.
Some points to think about:
interoperability
bandwidth
usagereadability
and simplifies debugging
However, there is a con. This may take a while because many programmers don't know SFV.
What is the feature you are proposing?
Structured Field Values is the standard spec for serialize structured object into http header value.
It already referrered by tons of newly defined http specs.
And also, IETF HTTP Working Group currently working on retrofit SFV with existing headers.
So we can say it's a best practice to use SFV for headers, not JSON in any headers. For avoiding developer using JSON or any other format, or SFV like format via hand-made-string-concat, Hono can natively support SFV encoder/decoder and guide developer to use it.
for example.
can be type gurded, by require SFList for value when key is
Cache-Status
.FYI: I published typed SFV library to npm https://github.com/jxck/structured-field-values
Thanks.