Use library const for HTTP verbs
This commit is contained in:
parent
68305df9b2
commit
f4d197485c
2 changed files with 2 additions and 2 deletions
2
derp.go
2
derp.go
|
@ -34,7 +34,7 @@ func loadDERPMapFromURL(addr url.URL) (*tailcfg.DERPMap, error) {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), HTTPReadTimeout)
|
ctx, cancel := context.WithTimeout(context.Background(), HTTPReadTimeout)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, "GET", addr.String(), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, addr.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,7 +174,7 @@ func (h *Headscale) DERPProbeHandler(
|
||||||
req *http.Request,
|
req *http.Request,
|
||||||
) {
|
) {
|
||||||
switch req.Method {
|
switch req.Method {
|
||||||
case "HEAD", "GET":
|
case http.MethodHead, http.MethodGet:
|
||||||
writer.Header().Set("Access-Control-Allow-Origin", "*")
|
writer.Header().Set("Access-Control-Allow-Origin", "*")
|
||||||
writer.WriteHeader(http.StatusOK)
|
writer.WriteHeader(http.StatusOK)
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue