mirror of
https://github.com/juanfont/headscale.git
synced 2024-12-22 07:57:34 +00:00
Use library const for HTTP verbs
This commit is contained in:
parent
68305df9b2
commit
f4d197485c
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…
x
Reference in New Issue
Block a user