Skip to content
Snippets Groups Projects
Commit f978a71f authored by Sebastian Ziebell's avatar Sebastian Ziebell
Browse files

Creating MR comment without a note returns status code 400 (Bad request)

Creating a comment to an existing merge request via API without providing a note
returns a status code 400 now, suggesting a bad request. The reason for this
is the resource itself (MR) exists but the required property is not set.
parent 3f4e215c
No related branches found
No related tags found
No related merge requests found
Loading
@@ -128,6 +128,9 @@ module Gitlab
Loading
@@ -128,6 +128,9 @@ module Gitlab
if note.save if note.save
present note, with: Entities::MRNote present note, with: Entities::MRNote
else else
if note.errors[:note].any?
error!(note.errors[:note], 400)
end
not_found! not_found!
end end
end end
Loading
Loading
Loading
@@ -87,6 +87,11 @@ describe Gitlab::API do
Loading
@@ -87,6 +87,11 @@ describe Gitlab::API do
response.status.should == 201 response.status.should == 201
json_response['note'].should == 'My comment' json_response['note'].should == 'My comment'
end end
it "should return 400 if note is missing" do
post api("/projects/#{project.id}/merge_request/#{merge_request.id}/comments", user)
response.status.should == 400
end
end end
   
end end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment