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
classUserController < ApplicationControllerdefindex
halt!(403, "Forbidden") if params[:user_id].nil?
render "index.slang"endend
and says
A status code of 403 was returned, and the content in render will not be delivered to the client.
which is not true. What really happens is that the client receives a response with the status of 403 but the content of the template. The core misunderstanding seems to be from a line further down that says
Unlike other frameworks Amber redirect_to stops the current execution of the request and performs the redirection at that given time...Since redirect_to uses the halt! method in the background.
For example, the docs show the controller:
and says
which is not true. What really happens is that the client receives a response with the status of 403 but the content of the template. The core misunderstanding seems to be from a line further down that says
I think there was a misunderstanding that calling
halt!
does something to immediately return from whatever it's called in. Maybe it was envisioned to raise an exception? This was never the case, though. The only thing it does is set the content value on the context and theroute
macro checks that value before running before_filters and the action https://github.com/amberframework/amber/blob/58eea3e147ba384fe4cb7c5f0a63da61b357e356/src/amber/dsl/router.cr#L14-L15The text was updated successfully, but these errors were encountered: