From 33c1463645b51bcb26932e4825df0ce8fee6c729 Mon Sep 17 00:00:00 2001 From: Sebastian Ziebell Date: Wed, 20 Feb 2013 22:17:05 +0100 Subject: 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. --- lib/api/notes.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/api/notes.rb') diff --git a/lib/api/notes.rb b/lib/api/notes.rb index 56de6e090e5..953514b6f04 100644 --- a/lib/api/notes.rb +++ b/lib/api/notes.rb @@ -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 -- cgit v1.2.1