Skip to content

Commit

Permalink
minor: fix: examples/mvc/error-handler-preflight: pr #1696
Browse files Browse the repository at this point in the history
[fix _examples] response.timestamp not appear in correct request.
  • Loading branch information
kataras authored Jan 9, 2021
2 parents 541fa75 + eb64006 commit cd1f82a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions _examples/mvc/error-handler-preflight/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type response struct {
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 {
r.Timestamp = time.Now().Unix()
}
Expand Down Expand Up @@ -64,15 +64,15 @@ type user struct {
ID uint64 `json:"id"`
}

func (c *controller) GetBy(userid uint64) response {
func (c *controller) GetBy(userid uint64) *response {
if userid != 1 {
return response{
return &response{
Code: iris.StatusNotFound,
Message: "User Not Found",
}
}

return response{
return &response{
ID: userid,
Data: user{ID: userid},
}
Expand Down

0 comments on commit cd1f82a

Please sign in to comment.