Merge pull request #1292 from influxdb/200_201

Return 201, not 200, after creation of user
pull/1293/head
Philip O'Toole 2015-01-05 16:02:17 -08:00
commit e4c57db75f
2 changed files with 2 additions and 1 deletions

View File

@ -276,6 +276,7 @@ func (h *Handler) serveCreateUser(w http.ResponseWriter, r *http.Request) {
h.error(w, err.Error(), http.StatusInternalServerError)
return
}
w.WriteHeader(http.StatusCreated)
}
// serveUpdateUser updates an existing user.

View File

@ -421,7 +421,7 @@ func TestHandler_CreateUser(t *testing.T) {
defer s.Close()
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)
} else if body != "" {
t.Fatalf("unexpected body: %s", body)