|
|
@ -91,6 +91,9 @@ func testRoute(t *testing.T, srv *Server) { |
|
|
|
if resp.StatusCode != 200 { |
|
|
|
if resp.StatusCode != 200 { |
|
|
|
t.Fatalf("code: %d", resp.StatusCode) |
|
|
|
t.Fatalf("code: %d", resp.StatusCode) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if v := resp.Header.Get("Content-Type"); v != "application/json" { |
|
|
|
|
|
|
|
t.Fatalf("contentType: %s", v) |
|
|
|
|
|
|
|
} |
|
|
|
u := new(User) |
|
|
|
u := new(User) |
|
|
|
if err := json.NewDecoder(resp.Body).Decode(u); err != nil { |
|
|
|
if err := json.NewDecoder(resp.Body).Decode(u); err != nil { |
|
|
|
t.Fatal(err) |
|
|
|
t.Fatal(err) |
|
|
@ -107,6 +110,9 @@ func testRoute(t *testing.T, srv *Server) { |
|
|
|
if resp.StatusCode != 201 { |
|
|
|
if resp.StatusCode != 201 { |
|
|
|
t.Fatalf("code: %d", resp.StatusCode) |
|
|
|
t.Fatalf("code: %d", resp.StatusCode) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if v := resp.Header.Get("Content-Type"); v != "application/json" { |
|
|
|
|
|
|
|
t.Fatalf("contentType: %s", v) |
|
|
|
|
|
|
|
} |
|
|
|
u = new(User) |
|
|
|
u = new(User) |
|
|
|
if err = json.NewDecoder(resp.Body).Decode(u); err != nil { |
|
|
|
if err = json.NewDecoder(resp.Body).Decode(u); err != nil { |
|
|
|
t.Fatal(err) |
|
|
|
t.Fatal(err) |
|
|
@ -125,6 +131,9 @@ func testRoute(t *testing.T, srv *Server) { |
|
|
|
if resp.StatusCode != 200 { |
|
|
|
if resp.StatusCode != 200 { |
|
|
|
t.Fatalf("code: %d", resp.StatusCode) |
|
|
|
t.Fatalf("code: %d", resp.StatusCode) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if v := resp.Header.Get("Content-Type"); v != "application/json" { |
|
|
|
|
|
|
|
t.Fatalf("contentType: %s", v) |
|
|
|
|
|
|
|
} |
|
|
|
u = new(User) |
|
|
|
u = new(User) |
|
|
|
if err = json.NewDecoder(resp.Body).Decode(u); err != nil { |
|
|
|
if err = json.NewDecoder(resp.Body).Decode(u); err != nil { |
|
|
|
t.Fatal(err) |
|
|
|
t.Fatal(err) |
|
|
|