Commit 67ca15bb authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'fix-systemhook-api' into 'master'

API: Return 400 when creating a systemhook fails

Closes #23335

See merge request !7350
parents 55e0065b 659ef546
---
title: Return 400 when creating a system hook fails
merge_request: 7350
author: Robert Schilling
...@@ -32,7 +32,7 @@ module API ...@@ -32,7 +32,7 @@ module API
if hook.save if hook.save
present hook, with: Entities::Hook present hook, with: Entities::Hook
else else
not_found! render_validation_error!(hook)
end end
end end
......
...@@ -52,6 +52,12 @@ describe API::API, api: true do ...@@ -52,6 +52,12 @@ describe API::API, api: true do
expect(response).to have_http_status(400) expect(response).to have_http_status(400)
end end
it "responds with 400 if url is invalid" do
post api("/hooks", admin), url: 'hp://mep.mep'
expect(response).to have_http_status(400)
end
it "does not create new hook without url" do it "does not create new hook without url" do
expect do expect do
post api("/hooks", admin) post api("/hooks", admin)
......
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