mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Use const http status code instead of just numbers see #24783
Signed-off-by: Doron Podoleanu <doronp@il.ibm.com>
This commit is contained in:
parent
5fe3e006e4
commit
6bec735c91
3 changed files with 7 additions and 7 deletions
|
@ -400,7 +400,7 @@ func (d *Daemon) queryRootDir() (string, error) {
|
|||
var b []byte
|
||||
var i Info
|
||||
b, err = readBody(body)
|
||||
if err == nil && resp.StatusCode == 200 {
|
||||
if err == nil && resp.StatusCode == http.StatusOK {
|
||||
// read the docker root dir
|
||||
if err = json.Unmarshal(b, &i); err == nil {
|
||||
return i.DockerRootDir, nil
|
||||
|
|
|
@ -152,7 +152,7 @@ func (t *testNotary) Ping() error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if resp.StatusCode != 200 {
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return fmt.Errorf("notary ping replied with an unexpected status code %d", resp.StatusCode)
|
||||
}
|
||||
return nil
|
||||
|
|
|
@ -125,7 +125,7 @@ func TestResponseModifier(t *testing.T) {
|
|||
m := NewResponseModifier(r)
|
||||
m.Header().Set("h1", "v1")
|
||||
m.Write([]byte("body"))
|
||||
m.WriteHeader(500)
|
||||
m.WriteHeader(http.StatusInternalServerError)
|
||||
|
||||
m.FlushAll()
|
||||
if r.Header().Get("h1") != "v1" {
|
||||
|
@ -134,7 +134,7 @@ func TestResponseModifier(t *testing.T) {
|
|||
if !reflect.DeepEqual(r.Body.Bytes(), []byte("body")) {
|
||||
t.Fatalf("Body value must exists %s", r.Body.Bytes())
|
||||
}
|
||||
if r.Code != 500 {
|
||||
if r.Code != http.StatusInternalServerError {
|
||||
t.Fatalf("Status code must be correct %d", r.Code)
|
||||
}
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ func TestResponseModifierOverride(t *testing.T) {
|
|||
m := NewResponseModifier(r)
|
||||
m.Header().Set("h1", "v1")
|
||||
m.Write([]byte("body"))
|
||||
m.WriteHeader(500)
|
||||
m.WriteHeader(http.StatusInternalServerError)
|
||||
|
||||
overrideHeader := make(http.Header)
|
||||
overrideHeader.Add("h1", "v2")
|
||||
|
@ -188,7 +188,7 @@ func TestResponseModifierOverride(t *testing.T) {
|
|||
|
||||
m.OverrideHeader(overrideHeaderBytes)
|
||||
m.OverrideBody([]byte("override body"))
|
||||
m.OverrideStatusCode(404)
|
||||
m.OverrideStatusCode(http.StatusNotFound)
|
||||
m.FlushAll()
|
||||
if r.Header().Get("h1") != "v2" {
|
||||
t.Fatalf("Header value must exists %s", r.Header().Get("h1"))
|
||||
|
@ -196,7 +196,7 @@ func TestResponseModifierOverride(t *testing.T) {
|
|||
if !reflect.DeepEqual(r.Body.Bytes(), []byte("override body")) {
|
||||
t.Fatalf("Body value must exists %s", r.Body.Bytes())
|
||||
}
|
||||
if r.Code != 404 {
|
||||
if r.Code != http.StatusNotFound {
|
||||
t.Fatalf("Status code must be correct %d", r.Code)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue