Skip to content
Snippets Groups Projects
Commit 55968280 authored by Will McCutchen's avatar Will McCutchen
Browse files

Add Content-Security-Policy header to index page

parent bc2cd169
No related branches found
No related tags found
No related merge requests found
......@@ -34,6 +34,7 @@ func (h *HTTPBin) Index(w http.ResponseWriter, r *http.Request) {
http.Error(w, "Not Found", http.StatusNotFound)
return
}
w.Header().Set("Content-Security-Policy", "default-src 'self'; style-src 'unsafe-inline'")
writeHTML(w, assets.MustAsset("index.html"), http.StatusOK)
}
......
......@@ -64,6 +64,7 @@ func TestIndex(t *testing.T) {
handler.ServeHTTP(w, r)
assertContentType(t, w, htmlContentType)
assertHeader(t, w, "Content-Security-Policy", "default-src 'self'; style-src 'unsafe-inline'")
assertBodyContains(t, w, "go-httpbin")
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment