Commit b0a52635 authored by Stan Hu's avatar Stan Hu

Merge branch 'ash.mckenzie/allowed-api-proper-http-status-code-support' into 'master'

Proper HTTP status code support for /api/v4/allowed API endpoint

Closes gitlab-ce#51211

See merge request gitlab-org/gitlab-shell!237
parents 49364693 0601b521
...@@ -35,7 +35,8 @@ class GitlabNet # rubocop:disable Metrics/ClassLength ...@@ -35,7 +35,8 @@ class GitlabNet # rubocop:disable Metrics/ClassLength
url = "#{internal_api_endpoint}/allowed" url = "#{internal_api_endpoint}/allowed"
resp = post(url, params) resp = post(url, params)
if resp.code == '200' case resp.code.to_s
when HTTP_SUCCESS, HTTP_UNAUTHORIZED, HTTP_NOT_FOUND
GitAccessStatus.create_from_json(resp.body) GitAccessStatus.create_from_json(resp.body)
else else
GitAccessStatus.new(false, GitAccessStatus.new(false,
......
module HTTPCodes
HTTP_SUCCESS = '200'.freeze
HTTP_UNAUTHORIZED = '401'.freeze
HTTP_NOT_FOUND = '404'.freeze
end
require_relative 'http_codes'
module HTTPHelper module HTTPHelper
include HTTPCodes
READ_TIMEOUT = 300 READ_TIMEOUT = 300
protected protected
......
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