Replace http method strings with net/http constants (#14677)

This commit is contained in:
Anton Averchenkov
2022-03-24 13:58:03 -04:00
committed by GitHub
parent 7f36a29e04
commit 0dd4cda7c9
26 changed files with 142 additions and 109 deletions

View File

@@ -1,6 +1,9 @@
package api
import "context"
import (
"context"
"net/http"
)
func (c *Sys) InitStatus() (bool, error) {
return c.InitStatusWithContext(context.Background())
@@ -10,7 +13,7 @@ func (c *Sys) InitStatusWithContext(ctx context.Context) (bool, error) {
ctx, cancelFunc := c.c.withConfiguredTimeout(ctx)
defer cancelFunc()
r := c.c.NewRequest("GET", "/v1/sys/init")
r := c.c.NewRequest(http.MethodGet, "/v1/sys/init")
resp, err := c.c.rawRequestWithContext(ctx, r)
if err != nil {
@@ -31,7 +34,7 @@ func (c *Sys) InitWithContext(ctx context.Context, opts *InitRequest) (*InitResp
ctx, cancelFunc := c.c.withConfiguredTimeout(ctx)
defer cancelFunc()
r := c.c.NewRequest("PUT", "/v1/sys/init")
r := c.c.NewRequest(http.MethodPut, "/v1/sys/init")
if err := r.SetJSONBody(opts); err != nil {
return nil, err
}