flexirest 1.7.7 → 1.7.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/docs/faraday-configuration.md +1 -0
- data/lib/flexirest/request.rb +1 -1
- data/lib/flexirest/version.rb +1 -1
- data/spec/lib/base_without_validation_spec.rb +9 -3
- data/spec/lib/request_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 392084cff2b3134307881a8e998b561ff49c8f5f3db22f5e6af4df495a8f8790
|
4
|
+
data.tar.gz: cd6928e4802e733483ea04de70765f2d069181b1f445ccb1ba188a3d247d8908
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65c520be2d605b87e665599e9bcc0d5d59752c86aa5cf68d17273ec894832296b37058fa13c700a57214c3a8255edd306f789c679a203c2daad35c375bf9b55a
|
7
|
+
data.tar.gz: f2dfcf7aa20f178d9dff64232577dc4a3810f77877d089ef85222ae78aa4c17df7ddc213691f8d104c8f8ff91a6f9e63e63097217ac56bc8e3f63da8b1ab9c82
|
data/CHANGELOG.md
CHANGED
@@ -18,6 +18,7 @@ For available configuration variables look into the [Faraday documentation](http
|
|
18
18
|
Flexirest::Base.faraday_config do |faraday|
|
19
19
|
faraday.adapter(:net_http)
|
20
20
|
faraday.options.timeout = 10
|
21
|
+
faraday.ssl.verify = false
|
21
22
|
faraday.headers['User-Agent'] = "Flexirest/#{Flexirest::VERSION}"
|
22
23
|
end
|
23
24
|
```
|
data/lib/flexirest/request.rb
CHANGED
@@ -459,7 +459,7 @@ module Flexirest
|
|
459
459
|
connection = Flexirest::ConnectionManager.get_connection(base_url)
|
460
460
|
end
|
461
461
|
else
|
462
|
-
parts = @url.match(%r{^(https?://[a-z\d\.:-]+?)(/.*)}).to_a
|
462
|
+
parts = @url.match(%r{^(https?://[a-z\d\.:-]+?)(/.*)?$}).to_a
|
463
463
|
if (parts.empty?) # Not a full URL, so use hostname/protocol from existing base_url
|
464
464
|
uri = URI.parse(base_url)
|
465
465
|
@base_url = "#{uri.scheme}://#{uri.host}#{":#{uri.port}" if uri.port != 80 && uri.port != 443}"
|
data/lib/flexirest/version.rb
CHANGED
@@ -330,14 +330,14 @@ describe Flexirest::BaseWithoutValidation do
|
|
330
330
|
|
331
331
|
it "passes headers" do
|
332
332
|
stub_request(:get, "http://api.example.com/v1").
|
333
|
-
with(headers: {'Accept'=>'application/hal+json, application/json;q=0.5', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Connection'=>'Keep-Alive', 'Content-Type'=>'application/x-www-form-urlencoded', 'X-Something'=>'foo/bar', 'User-Agent'=>/Flexirest\//}).
|
333
|
+
with(headers: {'Accept'=>'application/hal+json, application/json;q=0.5', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Connection'=>'Keep-Alive', 'Content-Type'=>'application/x-www-form-urlencoded; charset=utf-8', 'X-Something'=>'foo/bar', 'User-Agent'=>/Flexirest\//}).
|
334
334
|
to_return(status: 200, body: "", headers: {})
|
335
335
|
EmptyExample._request("http://api.example.com/v1", :get, {}, {headers: {"X-Something" => "foo/bar"}})
|
336
336
|
end
|
337
337
|
|
338
338
|
it "passes headers if the response is unparsed" do
|
339
339
|
stub_request(:get, "http://api.example.com/v1").
|
340
|
-
with(headers: {'Accept'=>'application/hal+json, application/json;q=0.5', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Connection'=>'Keep-Alive', 'Content-Type'=>'application/x-www-form-urlencoded', 'X-Something'=>'foo/bar', 'User-Agent'=>/Flexirest\//}).
|
340
|
+
with(headers: {'Accept'=>'application/hal+json, application/json;q=0.5', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Connection'=>'Keep-Alive', 'Content-Type'=>'application/x-www-form-urlencoded; charset=utf-8', 'X-Something'=>'foo/bar', 'User-Agent'=>/Flexirest\//}).
|
341
341
|
to_return(status: 200, body: "", headers: {})
|
342
342
|
EmptyExample._plain_request("http://api.example.com/v1", :get, {}, {headers: {"X-Something" => "foo/bar"}})
|
343
343
|
end
|
@@ -367,7 +367,13 @@ describe Flexirest::BaseWithoutValidation do
|
|
367
367
|
it "should be able to pass the plain response from the directly called URL bypassing JSON loading" do
|
368
368
|
response_body = "This is another non-JSON string"
|
369
369
|
expect_any_instance_of(Flexirest::Connection).to receive(:post).with(any_args).and_return(::FaradayResponseMock.new(OpenStruct.new(status:200, response_headers:{}, body:response_body)))
|
370
|
-
expect(EmptyExample._plain_request("http://api.example.com/", :post, {id:1234})).to eq(response_body)
|
370
|
+
expect(EmptyExample._plain_request("http://api.example.com/v1/something", :post, {id:1234})).to eq(response_body)
|
371
|
+
end
|
372
|
+
|
373
|
+
it "should be able to pass the plain response from the directly called URL bypassing JSON loading" do
|
374
|
+
response_body = "This is another non-JSON string"
|
375
|
+
expect_any_instance_of(Flexirest::Connection).to receive(:post).with(any_args).and_return(::FaradayResponseMock.new(OpenStruct.new(status:200, response_headers:{}, body:response_body)))
|
376
|
+
expect(EmptyExample._plain_request("http://api.example.com", :post, {id:1234})).to eq(response_body)
|
371
377
|
end
|
372
378
|
|
373
379
|
it "should return a PlainResponse from the directly called URL bypassing JSON loading" do
|
data/spec/lib/request_spec.rb
CHANGED
@@ -794,7 +794,7 @@ describe Flexirest::Request do
|
|
794
794
|
rescue Flexirest::HTTPServerException => e
|
795
795
|
e
|
796
796
|
end
|
797
|
-
expect(e.message).to eq(%q{
|
797
|
+
expect(e.message).to eq(%q{The POST to '/create' returned a 500 status, which raised a Flexirest::HTTPServerException with a body of: \{"first_name":"John", "id":1234\}})
|
798
798
|
end
|
799
799
|
|
800
800
|
it "should raise a parse exception for invalid JSON returns" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flexirest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Jeffries
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|