Setting correct content-type for JSONP
This commit is contained in:
parent
84d69a4f41
commit
542bea6fcc
|
@ -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)
|
||||
|
|
2
app.go
2
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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue