diff --git a/cmd/ubsserver/main.go b/cmd/ubsserver/main.go index 302ee01..ff97d9c 100644 --- a/cmd/ubsserver/main.go +++ b/cmd/ubsserver/main.go @@ -63,6 +63,7 @@ func sendJSONOk(w http.ResponseWriter, data interface{}) { } func sendJSONError(w http.ResponseWriter, err error) { + log.Println("ERROR: ", err) switch e := err.(type) { case bsync.SyncError: sendJSON(w, e.StatusCode, e.Payload) @@ -89,7 +90,8 @@ func info(w http.ResponseWriter, req *http.Request) { } func ensureJSONRequest(w http.ResponseWriter, req *http.Request) bool { - if strings.ToLower(req.Header["Content-Type"][0]) != "application/json" { + contentType := strings.Split(strings.ToLower(req.Header["Content-Type"][0]), ";")[0] + if contentType != "application/json" { sendJSONError(w, bsync.RequiredDataNotFoundError) return false }