mirror of
https://github.com/1f349/site-hosting.git
synced 2025-04-12 22:56:02 +01:00
Only allow GET requests in the serve handler
This commit is contained in:
parent
f3c05c46a8
commit
3719fc57cc
@ -68,6 +68,11 @@ func cacheBuster(rw http.ResponseWriter, req *http.Request) {
|
||||
}
|
||||
|
||||
func (h *Handler) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
|
||||
if req.Method != http.MethodGet {
|
||||
http.Error(rw, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed)
|
||||
return
|
||||
}
|
||||
|
||||
host, _, err := net.SplitHostPort(req.Host)
|
||||
if err != nil {
|
||||
host = req.Host
|
||||
|
@ -53,7 +53,7 @@ func serveTest(t *testing.T, address string, branch string, name string) {
|
||||
|
||||
//goland:noinspection HttpUrlsUsage
|
||||
const httpPrefix = "http://"
|
||||
req := httptest.NewRequest(http.MethodPost, httpPrefix+address, nil)
|
||||
req := httptest.NewRequest(http.MethodGet, httpPrefix+address, nil)
|
||||
if branch != "" {
|
||||
req.AddCookie(&http.Cookie{
|
||||
Name: "__bluebell-site-beta",
|
||||
|
Loading…
x
Reference in New Issue
Block a user