Commit 558dd811 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Improve broadcast message API

parent 833d4ddd
2.5.0
2.5.1
......@@ -83,7 +83,7 @@ module API
end
def authenticate_by_gitlab_shell_token!
unauthorized! unless secret_token == params['secret_token']
unauthorized! unless secret_token == params['secret_token'].try(:chomp)
end
def authenticated_as_admin!
......@@ -236,7 +236,7 @@ module API
end
def secret_token
File.read(Rails.root.join('.gitlab_shell_secret'))
File.read(Rails.root.join('.gitlab_shell_secret')).chomp
end
def handle_member_errors(errors)
......
......@@ -73,6 +73,8 @@ module API
get "/broadcast_message" do
if message = BroadcastMessage.current
present message, with: Entities::BroadcastMessage
else
{}
end
end
end
......
......@@ -32,7 +32,8 @@ describe API::API, api: true do
it do
get api("/internal/broadcast_message"), secret_token: secret_token
expect(response.status).to eq(404)
expect(response.status).to eq(200)
expect(json_response).to be_empty
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