mirror of
https://github.com/kataras/iris.git
synced 2025-12-19 19:07:06 +00:00
Fix _examples/mvc/login/user/controller.go redirection from POST: /user/register to GET: /user/me as reported at https://github.com/kataras/iris/issues/777
Former-commit-id: f26d36dfcb21fae7d3ce9b92fa97611dbc15802d
This commit is contained in:
@@ -46,6 +46,14 @@ func (c *Controller) PostRegister() {
|
||||
// setting a session value was never easier.
|
||||
c.Session.Set(sessionIDKey, user.ID)
|
||||
// succeed, nothing more to do here, just redirect to the /user/me.
|
||||
|
||||
// When redirecting from POST to GET request you -should- use this HTTP status code,
|
||||
// however there're some (complicated) alternatives if you
|
||||
// search online or even the HTTP RFC.
|
||||
c.Status = 303 // "See Other" RFC 7231
|
||||
|
||||
// Redirect to GET: /user/me
|
||||
// by changing the Path (and the status code because we're in POST request at this case).
|
||||
c.Path = pathMyProfile
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user