Skip to content
/ reply Public

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

License

Notifications You must be signed in to change notification settings

fel1xw/reply

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

License

Stars

Watchers

Forks

Packages

No packages published

Languages