add Rack::Request#prefetch? helper#2405
Conversation
jeremyevans
left a comment
There was a problem hiding this comment.
I'm not in favor of supporting the X-Sec-Purpose header. Seems like you would only want that if you were using Turbo, since it is non-standard. Absent backwards compatibility issues (which we don't have here as this would be a new method), I'd rather Rack support only standard headers by default.
d514856 to
47883ab
Compare
|
reasonable. can be mapped in a middleware. i removed the for reference, the reason turbo uses |
|
@rafaelfranca to get this working with turbo's
i personally sympathize with option 1 or 2. |
|
Can you please add a note to the changelog. |
47883ab to
0f648a0
Compare
done. |
0f648a0 to
2a61d3d
Compare
allows to effortlessly identify prefetch request as defined by WICG. inspects the `Sec-Purpose` header as defined in specification [0]. the usefulness is probably best explained by the following quote from the original fetch draft [1]: "The server can use this to adjust the caching expiry for prefetches, to disallow the prefetch, or to treat it differently when counting page visits." [0]: https://wicg.github.io/nav-speculation/prefetch.html#sec-purpose-header [1]: https://fetch.spec.whatwg.org/#http-sec-purpose also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-Purpose
2a61d3d to
c99ea7f
Compare
allows to effortlessly identify prefetch request as defined by WICG. inspects the
Sec-Purposeheader as defined in specification 0.the usefulness is probably best explained by the following quote from the original fetch draft 1:
"The server can use this to adjust the caching expiry for prefetches, to disallow the prefetch, or to treat it differently when counting page visits."
also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-Purpose
this header has quite a history. i thought about supporting more permutations but settled on what's in the spec.