You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an error occurs, I want to be able to respond to the user with something appropriate.
In the general case I'd like to look at the Accepts header and work out from that whether to provide the error back in the form of JSON or plain text or html.
In the specific case of serving static files, I'd also like to look at the request path so that I can use it alongside the Accepts header to figure out whether or to serve a root index.html file or return a 404 (to play nicely with the browser history API when doing client side routing. Logic is along the lines of; do they accept text/html, and does the path not end with an extension).
If when catching errors using recover, I had access to the underlying Request made by the user, I'd be able to achieve both of these things quite nicely.
The text was updated successfully, but these errors were encountered:
In the general case I'd like to look at the Accepts header and work out from that whether to provide the error back in the form of JSON or plain text or html.
that can be done by returning different Rejection's according to the Accepts header.
regarding the specific usecase for the fs filter, see #209 (comment)
When an error occurs, I want to be able to respond to the user with something appropriate.
In the general case I'd like to look at the
Accepts
header and work out from that whether to provide the error back in the form of JSON or plain text or html.In the specific case of serving static files, I'd also like to look at the request path so that I can use it alongside the
Accepts
header to figure out whether or to serve a rootindex.html
file or return a 404 (to play nicely with the browser history API when doing client side routing. Logic is along the lines of; do they accept text/html, and does the path not end with an extension).If when catching errors using
recover
, I had access to the underlyingRequest
made by the user, I'd be able to achieve both of these things quite nicely.The text was updated successfully, but these errors were encountered: