chore: linter: usestdlibvars
Signed-off-by: Jakob Borg <jakob@kastelo.net>
This commit is contained in:
+2
-2
@@ -546,7 +546,7 @@ func corsMiddleware(next http.Handler, allowFrameLoading bool) http.Handler {
|
||||
// See https://www.w3.org/TR/cors/ for details.
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
// Process OPTIONS requests
|
||||
if r.Method == "OPTIONS" {
|
||||
if r.Method == http.MethodOptions {
|
||||
// Add a generous access-control-allow-origin header for CORS requests
|
||||
w.Header().Add("Access-Control-Allow-Origin", "*")
|
||||
// Only GET/POST/OPTIONS Methods are supported
|
||||
@@ -557,7 +557,7 @@ func corsMiddleware(next http.Handler, allowFrameLoading bool) http.Handler {
|
||||
w.Header().Set("Access-Control-Max-Age", "600")
|
||||
|
||||
// Indicate that no content will be returned
|
||||
w.WriteHeader(204)
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
+3
-3
@@ -173,7 +173,7 @@ func (p *Process) Get(path string) ([]byte, error) {
|
||||
}
|
||||
|
||||
url := fmt.Sprintf("http://%s%s", p.addr, path)
|
||||
req, err := http.NewRequest("GET", url, nil)
|
||||
req, err := http.NewRequest(http.MethodGet, url, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -198,7 +198,7 @@ func (p *Process) Post(path string, data io.Reader) ([]byte, error) {
|
||||
},
|
||||
}
|
||||
url := fmt.Sprintf("http://%s%s", p.addr, path)
|
||||
req, err := http.NewRequest("POST", url, data)
|
||||
req, err := http.NewRequest(http.MethodPost, url, data)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -397,7 +397,7 @@ func (*Process) readResponse(resp *http.Response) ([]byte, error) {
|
||||
if err != nil {
|
||||
return bs, err
|
||||
}
|
||||
if resp.StatusCode != 200 {
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return bs, errors.New(resp.Status)
|
||||
}
|
||||
return bs, nil
|
||||
|
||||
@@ -48,7 +48,7 @@ func (c *dynamicClient) serve(ctx context.Context) error {
|
||||
|
||||
l.Debugln(c, "looking up dynamic relays")
|
||||
|
||||
req, err := http.NewRequestWithContext(ctx, "GET", uri.String(), nil)
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, uri.String(), nil)
|
||||
if err != nil {
|
||||
l.Debugln(c, "failed to lookup dynamic relays", err)
|
||||
return err
|
||||
|
||||
@@ -222,7 +222,7 @@ func upgradeToURL(archiveName, binary string, url string) error {
|
||||
func readRelease(archiveName, dir, url string) (string, error) {
|
||||
l.Debugf("loading %q", url)
|
||||
|
||||
req, err := http.NewRequest("GET", url, nil)
|
||||
req, err := http.NewRequest(http.MethodGet, url, nil)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
+1
-1
@@ -578,7 +578,7 @@ func soapRequestWithIP(ctx context.Context, url, service, function, message stri
|
||||
|
||||
body := fmt.Sprintf(template, message)
|
||||
|
||||
req, err := http.NewRequestWithContext(ctx, "POST", url, strings.NewReader(body))
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodPost, url, strings.NewReader(body))
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
|
||||
@@ -366,7 +366,7 @@ func (s *Service) sendUsageReport(ctx context.Context) error {
|
||||
},
|
||||
},
|
||||
}
|
||||
req, err := http.NewRequestWithContext(ctx, "POST", s.cfg.Options().URURL, &b)
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodPost, s.cfg.Options().URURL, &b)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user