flexirest 1.6.8 → 1.6.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 48c8e263cf0b1c959599454ce360b612b279b900
4
- data.tar.gz: eba90a77d94f9d8e29f651ec1a1b7815a10b4aa6
3
+ metadata.gz: 97942021a18075e99ef0ec8b44ddcfc65666ccf2
4
+ data.tar.gz: 0e65b5b0d7cc7ce9248118eb2d87bde8a4cb51d0
5
5
  SHA512:
6
- metadata.gz: a43bc7600fd621a71e595e55b1aebddc19feda4eae959a376c429eb4498e35d2f55c64c62c5a97f4769a98036d8f31a207da90e72de94133d38a5ad5c680b080
7
- data.tar.gz: 895458b577307cf2a2be5681fb827979847d61b13e36f89c236a3c1ddffcf3f98ace941fa9ed639e7cb7287ea5d291f0433f4ed8f360f5e7c305507e02853e4c
6
+ metadata.gz: 83f1b98ee42cc11c26edb512b85e30c050affd2d9efed3d3ccaa9a497c342aa5690f5f0ea16be3c18a99a5edb5657d97c2fc4ef0a8ffbdfe3edda590e174c6d2
7
+ data.tar.gz: d61bd29b62610ad7e852d843391f83c6f19d0fa5ab427c9993264c875e76d7b97442fc5ad60a3f3666de2f204e67321d0e2a2833a9e4067f4bdaa23cffa1d69d
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.6.9
4
+
5
+ Feature:
6
+
7
+ - Empty response bodies with an unparseable content-type are forced to be JSON with an empty JSON body
8
+
3
9
  ## 1.6.8
4
10
 
5
11
  Feature:
@@ -524,7 +524,10 @@ module Flexirest
524
524
  def handle_response(response, cached = nil)
525
525
  @response = response
526
526
  status = @response.status || 200
527
- @response.body = "{}" if @response.body.blank?
527
+ if @response.body.blank?
528
+ @response.response_headers['Content-Type'] = "application/json"
529
+ @response.body = "{}"
530
+ end
528
531
 
529
532
  if cached && response.status == 304
530
533
  Flexirest::Logger.debug " \033[1;4;32m#{Flexirest.name}\033[0m #{@instrumentation_name}" +
@@ -1,3 +1,3 @@
1
1
  module Flexirest
2
- VERSION = "1.6.8"
2
+ VERSION = "1.6.9"
3
3
  end
@@ -430,6 +430,11 @@ describe Flexirest::Request do
430
430
  expect(ExampleClient.all).to be_truthy
431
431
  end
432
432
 
433
+ it "should return true from 200 with empty bodies even if they don't have a correct content type" do
434
+ expect_any_instance_of(Flexirest::Connection).to receive(:get).with(any_args).and_return(::FaradayResponseMock.new(OpenStruct.new(status:200, response_headers:{"Content-Type" => "text/plain"}, body: nil)))
435
+ expect(ExampleClient.all).to be_truthy
436
+ end
437
+
433
438
  it "should return a lazy loader object if lazy loading is enabled" do
434
439
  object = LazyLoadedExampleClient.fake id:1234, debug:true
435
440
  expect(object).to be_an_instance_of(Flexirest::LazyLoader)
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.6.8
4
+ version: 1.6.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Jeffries
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-11 00:00:00.000000000 Z
11
+ date: 2018-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler