Skip to content

Commit

Permalink
Use http constants as function arguments
Browse files Browse the repository at this point in the history
Signed-off-by: Zechun Chen <[email protected]>
  • Loading branch information
Fish-pro committed Feb 13, 2023
1 parent 1df335f commit 52f8b2e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion edge/pkg/edgehub/certificate/certmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ func (cm *CertManager) GetEdgeCert(url string, capem []byte, cert tls.Certificat
if err != nil {
return nil, nil, err
}
if res.StatusCode != 200 {
if res.StatusCode != nethttp.StatusOK {
return nil, nil, fmt.Errorf(string(content))
}

Expand Down
2 changes: 1 addition & 1 deletion edge/pkg/servicebus/util/httpclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestURLClient_HTTPDo(t *testing.T) {
func getMockServer(t *testing.T) *httptest.Server {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.Method {
case "GET":
case http.MethodGet:
if r.URL.EscapedPath() != "/test" {
t.Errorf("path error: %s", r.URL.EscapedPath())
w.WriteHeader(http.StatusNotFound)
Expand Down
4 changes: 2 additions & 2 deletions edge/test/cloudhub/stub.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ func (tm *stubCloudHub) podHandler(w http.ResponseWriter, req *http.Request) {
}
var msgReq *model.Message
switch req.Method {
case "POST":
case http.MethodPost:
msgReq = model.NewMessage("").BuildRouter("edgecontroller", "resource",
"node/fake_node_id/pod/"+string(pod.UID), model.InsertOperation).FillBody(pod)
case "DELETE":
case http.MethodDelete:
msgReq = model.NewMessage("").BuildRouter("edgecontroller", "resource",
"node/fake_node_id/pod/"+string(pod.UID), model.DeleteOperation).FillBody(pod)
}
Expand Down
4 changes: 2 additions & 2 deletions edgesite/cmd/edgesite-server/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,11 +353,11 @@ func (p *Proxy) runHealthServer(o *options.ProxyRunOptions, server *server.Proxy
readinessHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
ready, msg := server.Readiness.Ready()
if ready {
w.WriteHeader(200)
w.WriteHeader(http.StatusOK)
fmt.Fprintf(w, "ok")
return
}
w.WriteHeader(500)
w.WriteHeader(http.StatusInternalServerError)
fmt.Fprintf(w, msg)
})

Expand Down

0 comments on commit 52f8b2e

Please sign in to comment.