flexirest 1.4.8 → 1.4.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: dba0e20c09300337a907fded156a930de346a476
4
- data.tar.gz: ec84a3c462438f8a9de3b854bee9e36de9b37a6b
3
+ metadata.gz: fb5d697d79a1b6068d551ea5346b87d83189eaad
4
+ data.tar.gz: 727a87951be313b214bcfd7d20a63eae1020e6b2
5
5
  SHA512:
6
- metadata.gz: de7100e5145ac080cff313e89fe5e3e4bdb46e825fb11dd7e4e08fa430dcdf8e91999484ff5dd3ec81fe20672e280e8ee153123c98eb11e41870e99aadfa7246
7
- data.tar.gz: f8ad4fc66b881b3f3f918ceed673bbba196569a4a1d519fcc1d722852728b9eefbba4407b3b12385138eabfe60886db77bac5bb90d52ccde1762a4d8d8e49a48
6
+ metadata.gz: 2a2122e343b6ac01a63e2fb0b872f0e03a00d5fd7ee1337df1258bac60bcc2f6fa859e15e3df04ef6fe35ed5575165bbb5b2cd001f2adc32238f8f6449e75a7a
7
+ data.tar.gz: a29e038eba07930db404505bcf59e0e7cb39f2e807eff1bfdc3fb8cbe64f1addb1fd7f1824f4815b1334c775864011c261d1fdbebce04907dbf22176531fe43e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.4.7
4
+
5
+ Bugfix:
6
+
7
+ - Responses without content (202, 204) will still make the headers available in `_headers`.
8
+
3
9
  ## 1.4.6
4
10
 
5
11
  Feature:
@@ -470,7 +470,8 @@ module Flexirest
470
470
  if @method[:options][:plain]
471
471
  return @response = Flexirest::PlainResponse.from_response(response)
472
472
  elsif [202, 204].include?(status) && @response.body.blank?
473
- return true
473
+ @response.body = "{}"
474
+ return @response = Flexirest::PlainResponse.from_response(response)
474
475
  elsif is_json_response? || is_xml_response?
475
476
  if @response.respond_to?(:proxied) && @response.proxied
476
477
  Flexirest::Logger.debug " \033[1;4;32m#{Flexirest.name}\033[0m #{@instrumentation_name} - Response was proxied, unable to determine size"
@@ -1,3 +1,3 @@
1
1
  module Flexirest
2
- VERSION = "1.4.8"
2
+ VERSION = "1.4.9"
3
3
  end
@@ -34,6 +34,7 @@ describe Flexirest::Request do
34
34
  get :plain, "/plain/:id", plain: true
35
35
  post :create, "/create"
36
36
  post :test_encoding, "/encoding", request_body_type: :json
37
+ post :testing_no_content_headers, "/no-content"
37
38
  put :update, "/put/:id"
38
39
  put :conversion, "/put/:id", parse_fields: [:converted]
39
40
  delete :remove, "/remove/:id"
@@ -556,6 +557,16 @@ describe Flexirest::Request do
556
557
  VerboseExampleClient.all
557
558
  end
558
559
 
560
+ it "should return the headers still for 202 responses" do
561
+ fake_location = "https://foo.example.com/123"
562
+ expect_any_instance_of(Flexirest::Connection).
563
+ to receive(:post).
564
+ with("/no-content", "", an_instance_of(Hash)).
565
+ and_return(::FaradayResponseMock.new(OpenStruct.new(body:"", response_headers:{"location" => fake_location}, status:202)))
566
+ response = ExampleClient.testing_no_content_headers
567
+ expect(response._headers["location"]).to eq(fake_location)
568
+ end
569
+
559
570
  it "should raise an unauthorised exception for 401 errors" do
560
571
  expect_any_instance_of(Flexirest::Connection).
561
572
  to receive(:post).
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.4.8
4
+ version: 1.4.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: 2017-09-01 00:00:00.000000000 Z
11
+ date: 2017-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler