4 ms·
I've always wished trailers were more powerful. Namely I have wished that they could contain Cookies. It would make certain types of processing simpler and lig
by donatj 2y ago
I've always wished trailers were more powerful. Namely I have wished that they could contain Cookies.
It would make certain types of processing simpler and lighter being able to stream SSR bodies as they are constructed rather than all at once at the end.
- josh3736 2y agoYou already can stream bodies as they're generated with chunked encoding; trailers aren't really needed for that. Cookies might be useful, but I guess you could do <script>document.cookie = '…'</script> right before the closing `</body>` if you really needed to set cookies late in the game. I'd love to see something to send content hashes (that browsers would actually verify), replacing the obsolete `Content-MD5`. Maybe `Integrity`, matching the `integrity` HTML attribute used in SRI? It could be a header (for static content) or trailer (for dynamic content).
- donatj 2y agoEh, a cookie set with JavaScript can't be HttpOnly. It also requires JavaScript. None of this is ideal.