hammer icon indicating copy to clipboard operation
hammer copied to clipboard

Support for Response Builder.

Open ShaileshSurya opened this issue 5 years ago • 1 comments

Rough Design:

func apiResponse(w http.ResponseWriter, r *http.Request) { 
  w.WriteHeader(http.StatusOK)
  w.Header().Set("Content-Type", "application/json")
  w.Write([]byte(`{"message":"hello world!"}`))
}
hammer.ResponseBuilder(http.ResponseWriter)
.WithStatus(http.StatusOK).
WithHeader("content-type","application/json").
WithBody(&map or &struct).
send()

The design is too vague but needs more investigation.

ShaileshSurya avatar Aug 25 '20 10:08 ShaileshSurya

@ZachPlunkett would you like to have a look at this as well.

ShaileshSurya avatar Oct 26 '20 06:10 ShaileshSurya