From 542bea6fcc1145e48d634185985505c63810958b Mon Sep 17 00:00:00 2001 From: Deluan Date: Thu, 9 Jan 2020 00:18:55 -0500 Subject: [PATCH] Setting correct content-type for JSONP --- api/api.go | 2 +- app.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/api.go b/api/api.go index f25c9de4..529912c5 100644 --- a/api/api.go +++ b/api/api.go @@ -123,7 +123,7 @@ func SendResponse(w http.ResponseWriter, r *http.Request, payload *responses.Sub wrapper := &responses.JsonWrapper{Subsonic: *payload} response, _ = json.Marshal(wrapper) case "jsonp": - w.Header().Set("Content-Type", "application/json") + w.Header().Set("Content-Type", "application/javascript") callback := ParamString(r, "callback") wrapper := &responses.JsonWrapper{Subsonic: *payload} data, _ := json.Marshal(wrapper) diff --git a/app.go b/app.go index c6cef350..f080625e 100644 --- a/app.go +++ b/app.go @@ -43,7 +43,7 @@ func (a *App) initRoutes() { r.Use(middleware.RequestID) r.Use(middleware.RealIP) r.Use(middleware.Recoverer) - r.Use(middleware.Compress(5, "application/xml", "application/json")) + r.Use(middleware.Compress(5, "application/xml", "application/json", "application/javascript")) r.Use(middleware.Heartbeat("/ping")) r.Use(InjectLogger)