mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-22 21:15:35 +03:00
15bba281ee
Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs
21 lines
456 B
Go
21 lines
456 B
Go
package websvc
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/AdguardTeam/AdGuardHome/internal/aghhttp"
|
|
"github.com/AdguardTeam/golibs/httphdr"
|
|
)
|
|
|
|
// Middlewares
|
|
|
|
// 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)
|
|
}
|