MCPcopy Index your code
hub / github.com/uber/aresdb / RespondJSONObjectWithCode

Function RespondJSONObjectWithCode

api/common/response.go:55–63  ·  view source on GitHub ↗

RespondJSONObjectWithCode with specified code and object.

(w http.ResponseWriter, code int, obj interface{})

Source from the content-addressed store, hash-verified

53
54// RespondJSONObjectWithCode with specified code and object.
55func RespondJSONObjectWithCode(w http.ResponseWriter, code int, obj interface{}) {
56 setCommonHeaders(w)
57 var err error
58 var jsonBytes []byte
59 if obj != nil {
60 jsonBytes, err = json.Marshal(obj)
61 }
62 writeJSONBytes(w, jsonBytes, err, code)
63}
64
65// RespondBytesWithCode with specified code and bytes.
66func RespondBytesWithCode(w http.ResponseWriter, code int, bs []byte) {

Callers 3

RespondFunction · 0.85
RespondWithJSONObjectFunction · 0.85
RespondWithErrorFunction · 0.85

Calls 2

setCommonHeadersFunction · 0.85
writeJSONBytesFunction · 0.85

Tested by

no test coverage detected