API: fixes return codes for notes, documentation updated
The notes API documentation updated with return codes. API now returns `400 Bad Request` if required attributes are not present. Return codes are documented now, also tested in added tests. The documentation now reflects the current state of the API.
This commit is contained in:
parent
f0e417091c
commit
33c1463645
3 changed files with 241 additions and 79 deletions
|
@ -37,6 +37,8 @@ module Gitlab
|
|||
# Example Request:
|
||||
# POST /projects/:id/notes
|
||||
post ":id/notes" do
|
||||
bad_request!(:body) unless params[:body].present?
|
||||
|
||||
@note = user_project.notes.new(note: params[:body])
|
||||
@note.author = current_user
|
||||
|
||||
|
@ -91,6 +93,9 @@ module Gitlab
|
|||
# POST /projects/:id/issues/:noteable_id/notes
|
||||
# POST /projects/:id/snippets/:noteable_id/notes
|
||||
post ":id/#{noteables_str}/:#{noteable_id_str}/notes" do
|
||||
bad_request!(:"#{noteable_id_str}") unless params[:"#{noteable_id_str}"].present?
|
||||
bad_request!(:body) unless params[:body].present?
|
||||
|
||||
@noteable = user_project.send(:"#{noteables_str}").find(params[:"#{noteable_id_str}"])
|
||||
@note = @noteable.notes.new(note: params[:body])
|
||||
@note.author = current_user
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue