Merge pull request #1292 from influxdb/200_201
Return 201, not 200, after creation of userpull/1293/head
commit
e4c57db75f
|
@ -276,6 +276,7 @@ func (h *Handler) serveCreateUser(w http.ResponseWriter, r *http.Request) {
|
||||||
h.error(w, err.Error(), http.StatusInternalServerError)
|
h.error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
w.WriteHeader(http.StatusCreated)
|
||||||
}
|
}
|
||||||
|
|
||||||
// serveUpdateUser updates an existing user.
|
// serveUpdateUser updates an existing user.
|
||||||
|
|
|
@ -421,7 +421,7 @@ func TestHandler_CreateUser(t *testing.T) {
|
||||||
defer s.Close()
|
defer s.Close()
|
||||||
|
|
||||||
status, body := MustHTTP("POST", s.URL+`/users`, `{"name":"jdoe","password":"1337"}`)
|
status, body := MustHTTP("POST", s.URL+`/users`, `{"name":"jdoe","password":"1337"}`)
|
||||||
if status != http.StatusOK {
|
if status != http.StatusCreated {
|
||||||
t.Fatalf("unexpected status: %d", status)
|
t.Fatalf("unexpected status: %d", status)
|
||||||
} else if body != "" {
|
} else if body != "" {
|
||||||
t.Fatalf("unexpected body: %s", body)
|
t.Fatalf("unexpected body: %s", body)
|
||||||
|
|
Loading…
Reference in New Issue