util/httpm: add new package for prettier HTTP method constants

See package doc.

Change-Id: Ibbfc8e1f98294217c56f3a9452bd93ffa3103572
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2023-01-26 19:35:26 -08:00
committed by Brad Fitzpatrick
parent 2703d6916f
commit a1b4ab34e6
8 changed files with 62 additions and 18 deletions

View File

@ -17,6 +17,7 @@ import (
"time"
"github.com/google/uuid"
"tailscale.com/util/httpm"
)
var (
@ -59,7 +60,7 @@ func SendAlert(summary, details string) error {
return errors.New("no SQUADCAST_WEBHOOK configured")
}
req, err := http.NewRequest(http.MethodPost, webhookUrl, bytes.NewBuffer(sqBody))
req, err := http.NewRequest(httpm.POST, webhookUrl, bytes.NewBuffer(sqBody))
if err != nil {
alertFailed.Add(1)
return err