Status code 400 is returned if body is missing on note creation.

If a note is created with a POST request via API (`/projects/:id/notes`) status
code 400 is returned instead of 404. The resource itself exists but the request
is incomplete. Specs added to check different status codes when accessing, creating
and updating notes.
This commit is contained in:
Sebastian Ziebell 2013-02-06 16:34:06 +01:00
parent b9d40d2524
commit bb24275f8d
2 changed files with 32 additions and 0 deletions

View file

@ -43,6 +43,8 @@ module Gitlab
if @note.save
present @note, with: Entities::Note
else
# :note is exposed as :body, but :note is set on error
error!(@note.errors[:note], 400) if @note.errors[:note].any?
not_found!
end
end