diff options
author | Steve <nilslice@gmail.com> | 2016-12-28 16:23:44 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-28 16:23:44 -0800 |
commit | 806fdbe1e8839feb1bcc4e5e07aa7c144a429901 (patch) | |
tree | dacaed91abb57bc6891c1b2cb58a82fc0c9610fc /system/api | |
parent | 1f7a5b46b906da00ceccb03e7ff26627bb29a3dd (diff) | |
parent | 5c340ca57e876a556a5b57e5a7dd32b0ae288440 (diff) |
Merge pull request #26 from ponzu-cms/ponzu-dev
[tooling] Add Go command flag, auto-generate self-signed SSL for development
Diffstat (limited to 'system/api')
-rw-r--r-- | system/api/handlers.go | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/system/api/handlers.go b/system/api/handlers.go index 788b2a0..7b59dbd 100644 --- a/system/api/handlers.go +++ b/system/api/handlers.go @@ -180,15 +180,6 @@ func toJSON(data []string) ([]byte, error) { return buf.Bytes(), nil } -func wrapJSON(json []byte) []byte { - var buf = &bytes.Buffer{} - buf.Write([]byte(`{"data":`)) - buf.Write(json) - buf.Write([]byte(`}`)) - - return buf.Bytes() -} - // sendData() should be used any time you want to communicate // data back to a foreign client func sendData(res http.ResponseWriter, data []byte, code int) { @@ -196,7 +187,10 @@ func sendData(res http.ResponseWriter, data []byte, code int) { res.Header().Set("Access-Control-Allow-Origin", "*") res.Header().Set("Content-Type", "application/json") res.WriteHeader(code) - res.Write(data) + _, err := res.Write(data) + if err != nil { + log.Println("Error writing to response in sendData") + } } // SendPreflight is used to respond to a cross-origin "OPTIONS" request |