From f4d197485ce0fcee0407e08fb1024d4c26ebeefb Mon Sep 17 00:00:00 2001 From: Juan Font Alonso Date: Sun, 4 Sep 2022 11:33:00 +0200 Subject: [PATCH] Use library const for HTTP verbs --- derp.go | 2 +- derp_server.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/derp.go b/derp.go index 6a153d2a..c3d100b3 100644 --- a/derp.go +++ b/derp.go @@ -34,7 +34,7 @@ func loadDERPMapFromURL(addr url.URL) (*tailcfg.DERPMap, error) { ctx, cancel := context.WithTimeout(context.Background(), HTTPReadTimeout) defer cancel() - req, err := http.NewRequestWithContext(ctx, "GET", addr.String(), nil) + req, err := http.NewRequestWithContext(ctx, http.MethodGet, addr.String(), nil) if err != nil { return nil, err } diff --git a/derp_server.go b/derp_server.go index dbdbc7a5..b9650154 100644 --- a/derp_server.go +++ b/derp_server.go @@ -174,7 +174,7 @@ func (h *Headscale) DERPProbeHandler( req *http.Request, ) { switch req.Method { - case "HEAD", "GET": + case http.MethodHead, http.MethodGet: writer.Header().Set("Access-Control-Allow-Origin", "*") writer.WriteHeader(http.StatusOK) default: