mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-12-19 13:31:53 +03:00
1d6d85cff4
Squashed commit of the following: commit586b0eb180
Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Tue Nov 12 19:58:56 2024 +0300 next: upd more commitd729aa150f
Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Tue Nov 12 16:53:15 2024 +0300 next/websvc: upd more commit0c64e6cfc6
Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon Nov 11 21:08:51 2024 +0300 next: upd more commit05eec75222
Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Nov 8 19:20:02 2024 +0300 next: upd code
19 lines
440 B
Go
19 lines
440 B
Go
package websvc
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/AdguardTeam/AdGuardHome/internal/aghhttp"
|
|
"github.com/AdguardTeam/golibs/httphdr"
|
|
)
|
|
|
|
// jsonMw sets the content type of the response to application/json.
|
|
func jsonMw(h http.Handler) (wrapped http.HandlerFunc) {
|
|
f := func(w http.ResponseWriter, r *http.Request) {
|
|
w.Header().Set(httphdr.ContentType, aghhttp.HdrValApplicationJSON)
|
|
|
|
h.ServeHTTP(w, r)
|
|
}
|
|
|
|
return http.HandlerFunc(f)
|
|
}
|