MCPcopy
hub / github.com/dgraph-io/dgraph / writeSuccessResponse

Function writeSuccessResponse

dgraph/cmd/alpha/http.go:743–757  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

741}
742
743func writeSuccessResponse(w http.ResponseWriter, r *http.Request) {
744 res := map[string]interface{}{}
745 data := map[string]interface{}{}
746 data["code"] = x.Success
747 data["message"] = "Done"
748 res["data"] = data
749
750 js, err := json.Marshal(res)
751 if err != nil {
752 x.SetStatus(w, x.Error, err.Error())
753 return
754 }
755
756 _, _ = x.WriteResponse(w, r, js)
757}
758
759// skipJSONUnmarshal stores the raw bytes as is while JSON unmarshaling.
760type skipJSONUnmarshal struct {

Callers 2

alterHandlerFunction · 0.85
adminSchemaHandlerFunction · 0.85

Calls 3

SetStatusFunction · 0.92
WriteResponseFunction · 0.92
ErrorMethod · 0.45

Tested by

no test coverage detected