1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-09 21:15:56 +00:00

minor: fix: examples/mvc/error-handler-preflight: pr #1696

[fix _examples] response.timestamp not appear in correct request.
This commit is contained in:
Gerasimos (Makis) Maropoulos
2021-01-09 03:35:33 +02:00
committed by GitHub

View File

@@ -29,7 +29,7 @@ type response struct {
Timestamp int64 `json:"timestamp,omitempty"` Timestamp int64 `json:"timestamp,omitempty"`
} }
func (r response) Preflight(ctx iris.Context) error { func (r *response) Preflight(ctx iris.Context) error {
if r.ID > 0 { if r.ID > 0 {
r.Timestamp = time.Now().Unix() r.Timestamp = time.Now().Unix()
} }
@@ -64,15 +64,15 @@ type user struct {
ID uint64 `json:"id"` ID uint64 `json:"id"`
} }
func (c *controller) GetBy(userid uint64) response { func (c *controller) GetBy(userid uint64) *response {
if userid != 1 { if userid != 1 {
return response{ return &response{
Code: iris.StatusNotFound, Code: iris.StatusNotFound,
Message: "User Not Found", Message: "User Not Found",
} }
} }
return response{ return &response{
ID: userid, ID: userid,
Data: user{ID: userid}, Data: user{ID: userid},
} }