1
mirror of https://gitlab.com/commento/commento.git synced 2025-06-29 22:56:37 -04:00

api: standardise marshal and unmarshal fn names

This commit is contained in:
Adhityaa Chandrasekar
2018-07-24 12:28:43 +05:30
parent 9974365b73
commit a8ecbd9717
23 changed files with 127 additions and 127 deletions

View File

@ -11,7 +11,7 @@ type response map[string]interface{}
// TODO: Add tests in utils_http_test.go
func unmarshalBody(r *http.Request, x interface{}) error {
func bodyUnmarshal(r *http.Request, x interface{}) error {
b, err := ioutil.ReadAll(r.Body)
if err != nil {
logger.Errorf("cannot read POST body: %v\n", err)
@ -32,7 +32,7 @@ func unmarshalBody(r *http.Request, x interface{}) error {
return nil
}
func writeBody(w http.ResponseWriter, x map[string]interface{}) error {
func bodyMarshal(w http.ResponseWriter, x map[string]interface{}) error {
resp, err := json.Marshal(x)
if err != nil {
w.Write([]byte(`{"success":false,"message":"Some internal error occurred"}`))