jira-ruby 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jira/http_client.rb +12 -1
- data/lib/jira/version.rb +1 -1
- data/spec/jira/http_client_spec.rb +13 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3dba12b300beb17d9fa96eedccd1d7d12f89d79
|
4
|
+
data.tar.gz: '09dbc7b324844b080c211098ec939b61f6c07389'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a28d13eef6768243696eaba28218c45d5ba0018b7f0537bbb91c3ef0b0c4d16dc9245b239dfde587215130a9cbf59a20dba60408f9907d9b4ecc92c546a9f69
|
7
|
+
data.tar.gz: 2025610542803cd4934cc415dd5902f47c739cdf3493ee7eafc60f4d842cf38dbdc6afdcc247c66e09d148d204b8c08c73d8502cd10605b49b0f6b7e63c79069
|
data/lib/jira/http_client.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'json'
|
2
2
|
require 'net/https'
|
3
3
|
require 'cgi/cookie'
|
4
|
+
require 'uri'
|
4
5
|
|
5
6
|
module JIRA
|
6
7
|
class HttpClient < RequestClient
|
@@ -24,7 +25,9 @@ module JIRA
|
|
24
25
|
make_request(:post, @options[:context_path] + '/rest/auth/1/session', body, {'Content-Type' => 'application/json'})
|
25
26
|
end
|
26
27
|
|
27
|
-
def make_request(http_method,
|
28
|
+
def make_request(http_method, url, body='', headers={})
|
29
|
+
# When a proxy is enabled, Net::HTTP expects that the request path omits the domain name
|
30
|
+
path = request_path(url)
|
28
31
|
request = Net::HTTP.const_get(http_method.to_s.capitalize).new(path, headers)
|
29
32
|
request.body = body unless body.nil?
|
30
33
|
add_cookies(request) if options[:use_cookies]
|
@@ -62,6 +65,14 @@ module JIRA
|
|
62
65
|
|
63
66
|
private
|
64
67
|
|
68
|
+
def request_path(url)
|
69
|
+
parsed_uri = URI(url)
|
70
|
+
|
71
|
+
return url unless parsed_uri.is_a?(URI::HTTP)
|
72
|
+
|
73
|
+
parsed_uri.request_uri
|
74
|
+
end
|
75
|
+
|
65
76
|
def store_cookies(response)
|
66
77
|
cookies = response.get_fields('set-cookie')
|
67
78
|
if cookies
|
data/lib/jira/version.rb
CHANGED
@@ -138,6 +138,19 @@ describe JIRA::HttpClient do
|
|
138
138
|
basic_client.make_request(:get, '/foo', body, headers)
|
139
139
|
end
|
140
140
|
|
141
|
+
it "performs a basic http client request with a full domain" do
|
142
|
+
body = nil
|
143
|
+
headers = double()
|
144
|
+
basic_auth_http_conn = double()
|
145
|
+
http_request = double()
|
146
|
+
expect(Net::HTTP::Get).to receive(:new).with('/foo', headers).and_return(http_request)
|
147
|
+
|
148
|
+
expect(basic_auth_http_conn).to receive(:request).with(http_request).and_return(response)
|
149
|
+
expect(http_request).to receive(:basic_auth).with(basic_client.options[:username], basic_client.options[:password]).and_return(http_request)
|
150
|
+
allow(basic_client).to receive(:basic_auth_http_conn).and_return(basic_auth_http_conn)
|
151
|
+
basic_client.make_request(:get, 'http://mydomain.com/foo', body, headers)
|
152
|
+
end
|
153
|
+
|
141
154
|
it "returns a URI" do
|
142
155
|
uri = URI.parse(basic_client.options[:site])
|
143
156
|
expect(basic_client.uri).to eq(uri)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jira-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SUMO Heavy Industries
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-08-
|
12
|
+
date: 2017-08-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: oauth
|