Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gee-web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func onlyForV2() gee.HandlerFunc {
// Start timer
t := time.Now()
// if a server error occurred
c.Fail(500, "Internal Server Error")
c.Fail(http.StatusInternalServerError, "Internal Server Error")
// Calculate resolution time
log.Printf("[%d] %s in %v for group v2", c.StatusCode, c.Req.RequestURI, time.Since(t))
}
Expand Down
2 changes: 1 addition & 1 deletion gee-web/day2-context/gee/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (c *Context) JSON(code int, obj interface{}) {
c.Status(code)
encoder := json.NewEncoder(c.Writer)
if err := encoder.Encode(obj); err != nil {
http.Error(c.Writer, err.Error(), 500)
http.Error(c.Writer, err.Error(), http.StatusInternalServerError)
}
}

Expand Down
2 changes: 1 addition & 1 deletion gee-web/day3-router/gee/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (c *Context) JSON(code int, obj interface{}) {
c.Status(code)
encoder := json.NewEncoder(c.Writer)
if err := encoder.Encode(obj); err != nil {
http.Error(c.Writer, err.Error(), 500)
http.Error(c.Writer, err.Error(), http.StatusInternalServerError)
}
}

Expand Down
2 changes: 1 addition & 1 deletion gee-web/day4-group/gee/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (c *Context) JSON(code int, obj interface{}) {
c.Status(code)
encoder := json.NewEncoder(c.Writer)
if err := encoder.Encode(obj); err != nil {
http.Error(c.Writer, err.Error(), 500)
http.Error(c.Writer, err.Error(), http.StatusInternalServerError)
}
}

Expand Down
2 changes: 1 addition & 1 deletion gee-web/day5-middleware/gee/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (c *Context) JSON(code int, obj interface{}) {
c.Status(code)
encoder := json.NewEncoder(c.Writer)
if err := encoder.Encode(obj); err != nil {
http.Error(c.Writer, err.Error(), 500)
http.Error(c.Writer, err.Error(), http.StatusInternalServerError)
}
}

Expand Down
2 changes: 1 addition & 1 deletion gee-web/day5-middleware/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func onlyForV2() gee.HandlerFunc {
// Start timer
t := time.Now()
// if a server error occurred
c.Fail(500, "Internal Server Error")
c.Fail(http.StatusInternalServerError, "Internal Server Error")
// Calculate resolution time
log.Printf("[%d] %s in %v for group v2", c.StatusCode, c.Req.RequestURI, time.Since(t))
}
Expand Down
4 changes: 2 additions & 2 deletions gee-web/day6-template/gee/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (c *Context) JSON(code int, obj interface{}) {
c.Status(code)
encoder := json.NewEncoder(c.Writer)
if err := encoder.Encode(obj); err != nil {
http.Error(c.Writer, err.Error(), 500)
http.Error(c.Writer, err.Error(), http.StatusInternalServerError)
}
}

Expand All @@ -96,6 +96,6 @@ func (c *Context) HTML(code int, name string, data interface{}) {
c.SetHeader("Content-Type", "text/html")
c.Status(code)
if err := c.engine.htmlTemplates.ExecuteTemplate(c.Writer, name, data); err != nil {
c.Fail(500, err.Error())
c.Fail(http.StatusInternalServerError, err.Error())
}
}
4 changes: 2 additions & 2 deletions gee-web/day7-panic-recover/gee/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (c *Context) JSON(code int, obj interface{}) {
c.Status(code)
encoder := json.NewEncoder(c.Writer)
if err := encoder.Encode(obj); err != nil {
http.Error(c.Writer, err.Error(), 500)
http.Error(c.Writer, err.Error(), http.StatusInternalServerError)
}
}

Expand All @@ -96,6 +96,6 @@ func (c *Context) HTML(code int, name string, data interface{}) {
c.SetHeader("Content-Type", "text/html")
c.Status(code)
if err := c.engine.htmlTemplates.ExecuteTemplate(c.Writer, name, data); err != nil {
c.Fail(500, err.Error())
c.Fail(http.StatusInternalServerError, err.Error())
}
}
4 changes: 2 additions & 2 deletions gee-web/doc/gee-day2.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
encoder := json.NewEncoder(w)
if err := encoder.Encode(obj); err != nil {
http.Error(w, err.Error(), 500)
http.Error(w, err.Error(), http.StatusInternalServerError)
}
```

Expand Down Expand Up @@ -146,7 +146,7 @@ func (c *Context) JSON(code int, obj interface{}) {
c.Status(code)
encoder := json.NewEncoder(c.Writer)
if err := encoder.Encode(obj); err != nil {
http.Error(c.Writer, err.Error(), 500)
http.Error(c.Writer, err.Error(), http.StatusInternalServerError)
}
}

Expand Down
2 changes: 1 addition & 1 deletion gee-web/doc/gee-day5.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func onlyForV2() gee.HandlerFunc {
// Start timer
t := time.Now()
// if a server error occurred
c.Fail(500, "Internal Server Error")
c.Fail(http.StatusInternalServerError, "Internal Server Error")
// Calculate resolution time
log.Printf("[%d] %s in %v for group v2", c.StatusCode, c.Req.RequestURI, time.Since(t))
}
Expand Down
2 changes: 1 addition & 1 deletion gee-web/doc/gee-day6.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func (c *Context) HTML(code int, name string, data interface{}) {
c.SetHeader("Content-Type", "text/html")
c.Status(code)
if err := c.engine.htmlTemplates.ExecuteTemplate(c.Writer, name, data); err != nil {
c.Fail(500, err.Error())
c.Fail(http.StatusInternalServerError, err.Error())
}
}
```
Expand Down