Class: Gitlab::Jira::HttpClient
- Inherits:
-
JIRA::HttpClient
- Object
- JIRA::HttpClient
- Gitlab::Jira::HttpClient
show all
- Extended by:
- Utils::Override
- Defined in:
- lib/gitlab/jira/http_client.rb
Overview
Instance Method Summary
collapse
extended, extensions, included, method_added, override, prepended, queue_verification, verify!
Instance Method Details
#make_cookie_auth_request ⇒ Object
21
22
23
24
25
26
27
28
|
# File 'lib/gitlab/jira/http_client.rb', line 21
def make_cookie_auth_request
body = {
username: @options.delete(:username),
password: @options.delete(:password)
}.to_json
make_request(:post, @options[:context_path] + '/rest/auth/1/session', body, 'Content-Type' => 'application/json')
end
|
#make_request(http_method, path, body = '', headers = {}) ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/gitlab/jira/http_client.rb', line 31
def make_request(http_method, path, body = '', = {})
request_params = { headers: }
request_params[:body] = body if body.present?
request_params[:headers][:Cookie] = get_cookies if options[:use_cookies]
request_params[:base_uri] = uri.to_s
request_params.merge!(auth_params)
request_params[:open_timeout] = options[:open_timeout] || default_timeout_for(:open_timeout)
request_params[:read_timeout] = options[:read_timeout] || default_timeout_for(:read_timeout)
request_params[:write_timeout] = options[:write_timeout] || default_timeout_for(:write_timeout)
request_params[:timeout] = [
Gitlab::HTTP::DEFAULT_READ_TOTAL_TIMEOUT,
request_params[:open_timeout],
request_params[:read_timeout],
request_params[:write_timeout]
].max
result = Gitlab::HTTP.public_send(http_method, path, **request_params) @authenticated = result.response.is_a?(Net::HTTPOK)
store_cookies(result) if options[:use_cookies]
result.response.body = result.body
result
end
|
#request(*args) ⇒ Object
12
13
14
15
16
17
18
|
# File 'lib/gitlab/jira/http_client.rb', line 12
def request(*args)
result = make_request(*args)
raise JIRA::HTTPError, result.response unless result.response.is_a?(Net::HTTPSuccess)
result
end
|