1
0
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:
Gerasimos (Makis) Maropoulos
2017-10-05 03:26:39 +03:00
parent f780159afe
commit b2a24d36e8
3 changed files with 14 additions and 6 deletions

View File

@@ -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
}