Commit 2bd95596 authored by Sebastian Ziebell's avatar Sebastian Ziebell

Changed function to `not_found`.

Instead of using funtion `error!` the function `not_found!` is used to return 404 error. Adjusted documentation accordingly.
parent 40e7846f
...@@ -79,6 +79,9 @@ Parameters: ...@@ -79,6 +79,9 @@ Parameters:
} }
``` ```
Will return status code `200` on success or `404 Not found` if the branch is not available.
## Protect a project repository branch ## Protect a project repository branch
Protect a single project repository branch. Protect a single project repository branch.
......
...@@ -230,7 +230,7 @@ module Gitlab ...@@ -230,7 +230,7 @@ module Gitlab
# GET /projects/:id/repository/branches/:branch # GET /projects/:id/repository/branches/:branch
get ":id/repository/branches/:branch" do get ":id/repository/branches/:branch" do
@branch = user_project.repo.heads.find { |item| item.name == params[:branch] } @branch = user_project.repo.heads.find { |item| item.name == params[:branch] }
error!("Branch does not exist", 404) if @branch.nil? not_found!("Branch does not exist") if @branch.nil?
present @branch, with: Entities::RepoObject, project: user_project present @branch, with: Entities::RepoObject, project: user_project
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