flexirest 1.3.26 → 1.3.27

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: 7e5d860a92f3a3ce66635458548eeffa50fa9bde
4
- data.tar.gz: 1992115ebc006ee19ad9650e61641ca01ed60a47
3
+ metadata.gz: 41037b044f911e96fa8ef57aaacae1c8ab7b4c46
4
+ data.tar.gz: fa0e305dfa953cab72072df58e10d8fbad96bef9
5
5
  SHA512:
6
- metadata.gz: f3d01faf990a544d09f734d123842a456c2dfdad898549a88b4555f2042b82d24962fc155a26ef24a952e946d4e09731a36625fd2fd9c1f175b8f5cea8920bd1
7
- data.tar.gz: 76382e77ae23a93feddb2317ecb9b515a9e65e7cfb05cf43dfa8ac0b35b4856c840f527c068fc12937ba914f76c4cbb6dcbea6e8c78bbfb4a10607df3d384d14
6
+ metadata.gz: aea60eaa4a88d43f48c87d3e7753660f7042b1cfc7ddc682454c21c9bbab28db9fcb29839a703409326166f9e02bc80479900d791b47aec0c782829e1bd440e5
7
+ data.tar.gz: c7f4e0e891019152782e07fc3546bccdab28a401ccb40e3b37d922d89cfe65ff2980260e5f03595273271caf13f1f40ebc501d3359c910145cec19618c742eaf
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.3.27
4
+
5
+ Bugfix:
6
+
7
+ - HTTP GET requests shouldn't send any body, JSON-encoded or otherwise
8
+
3
9
  ## 1.3.26
4
10
 
5
11
  Bugfix:
@@ -46,5 +46,6 @@ Gem::Specification.new do |spec|
46
46
  if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.0.0')
47
47
  spec.add_runtime_dependency "json", "< 2.0.0"
48
48
  spec.add_runtime_dependency "tins", "~> 1.6.0"
49
+ spec.add_runtime_dependency "term-ansicolor", "~> 1.3.2"
49
50
  end
50
51
  end
@@ -287,7 +287,9 @@ module Flexirest
287
287
  end
288
288
 
289
289
  def prepare_request_body(params = nil)
290
- if request_body_type == :form_encoded
290
+ if http_method == :get
291
+ @body = ""
292
+ elsif request_body_type == :form_encoded
291
293
  @body ||= (params || @post_params || {}).to_query
292
294
  headers["Content-Type"] ||= "application/x-www-form-urlencoded"
293
295
  elsif request_body_type == :json
@@ -1,3 +1,3 @@
1
1
  module Flexirest
2
- VERSION = "1.3.26"
2
+ VERSION = "1.3.27"
3
3
  end
@@ -238,6 +238,12 @@ describe Flexirest::Request do
238
238
  ExampleClient.update id:1234, debug:true, test:'foo'
239
239
  end
240
240
 
241
+ it "should not pass through an encoded empty body parameter" do
242
+ expect_any_instance_of(Flexirest::Connection).to receive(:get).with("/1234", an_instance_of(Hash)).and_return(::FaradayResponseMock.new(OpenStruct.new(body:"{\"result\":true}", response_headers:{})))
243
+ ExampleClient.request_body_type :json
244
+ ExampleClient.find id:1234
245
+ end
246
+
241
247
  it "allows forcing a request_body_type per request" do
242
248
  expect_any_instance_of(Flexirest::Connection).to receive(:post).with("/encoding", %q({"id":1234,"test":"something"}), an_instance_of(Hash)).and_return(::FaradayResponseMock.new(OpenStruct.new(body:"{\"result\":true}", response_headers:{})))
243
249
  ExampleClient.request_body_type :form_encoded # Should be ignored and the per_method :json used
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.3.26
4
+ version: 1.3.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Jeffries
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-02 00:00:00.000000000 Z
11
+ date: 2016-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler