Commit f978a71f authored by Sebastian Ziebell's avatar Sebastian Ziebell

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
......@@ -128,6 +128,9 @@ module Gitlab
if note.save
present note, with: Entities::MRNote
else
if note.errors[:note].any?
error!(note.errors[:note], 400)
end
not_found!
end
end
......
......@@ -87,6 +87,11 @@ describe Gitlab::API do
response.status.should == 201
json_response['note'].should == 'My comment'
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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment