Skip to content
fel1xwPublic

About

Small utility function to easily set status codes to `http.ResponseWriters` 👨‍💻

Topics

Resources

Stars

5 stars

Watchers

1 watching

Forks

Latest commit

 

History

20 Commits

Folders and files

Repository files navigation

Logo

Reply GoDoc Build Status Go Version Go Report Card

  • Easy to write and read
  • JSON mode enabled by default
    • Sets Content-Type to be application/json
    • uses json.NewDecoder(w).Encode(data)
  • Simplifies status code responses

Usage

type User struct {
  ID string `json:"id"`
  Name string `json:"name"`
}

func CreateUserHandler(w http.ResponseWriter, r *http.Request) {
  u := &User{ID: "123", Name: "Felix"}
  reply.Created(w, u)
}

About

Small utility function to easily set status codes to `http.ResponseWriters` 👨‍💻

Topics

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages