1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-11 14:05:59 +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

@@ -330,10 +330,8 @@ typescript automation tools have their own repository: [https://github.com/katar
> I'd like to tell you that you can use your favourite but I don't think you will find such a thing anywhere else.
### Hey, You!
### Hey, You
Developers should read the [godocs](https://godoc.org/github.com/kataras/iris) for a better understanding.
Developers should read the [godocs](https://godoc.org/github.com/kataras/iris) and https://docs.iris-go.com for a better understanding.
Psst, I almost forgot; do not forget to [star or watch](https://github.com/kataras/iris/stargazers) the project in order to stay updated with the latest tech trends, it never takes more than a second!

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
}