flexirest 1.5.5 → 1.5.6

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: c539f302332de70b8e529cc91c7dabc1969d0749
4
- data.tar.gz: 24540b75ac1730f4070324816f911b88259371eb
3
+ metadata.gz: 1b93954670ad807a5d5fd425e8dc837e6fc12391
4
+ data.tar.gz: dea19725cce211d236ccf111fecf8853ca5a1ff8
5
5
  SHA512:
6
- metadata.gz: a810e9776a26e970f4fd2be25501e84b7fb33a1056281ffb7cbb75fa55f23285a5dcad5f4d28d948bcc55e72cacebe540eab968352704c30acddc13423edbb70
7
- data.tar.gz: 4e971064716e6bb1d38e4c4714570395fbd98cfadb435493c27300cfa30af34308738b4b267e855c082b2e78302f4d6f5c011faecc4fd009c29e3c4fb1765cb5
6
+ metadata.gz: a03ade8ba0333f75128c5d363a035b27f1d4c17257b60b2ce782513b6c89fc71f4862cb8b5b631dc8fdfe77c5ae9556a41ee1043ad45b3e746edae19fb2f448c
7
+ data.tar.gz: 3fa5c79a05012ace79e041df2f403dacf58777beaa55425ae71acf17a248007860b0d0d79d2398e054c4e7472eb985a0b5bf2589394386acffc355f966774694
data/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.5.6
4
+
5
+ Feature:
6
+
7
+ - Allow deleting of default headers in `before_request` callbacks
8
+
9
+ ## 1.5.5
10
+
11
+ Bugfix:
12
+
13
+ - Fixing already encoded bodies in plain requests
14
+
15
+ ## 1.5.4
16
+
17
+ Feature:
18
+
19
+ - Changing `_request` to accept options, including `:headers`, rather than headers directly
20
+
3
21
  ## 1.5.3
4
22
 
5
23
  Feature:
@@ -1,6 +1,7 @@
1
1
  module Flexirest
2
2
  class HeadersList
3
3
  STORE_MULTIPLE_VALUES = ["set-cookie"]
4
+
4
5
  def initialize
5
6
  @store = {}
6
7
  end
@@ -33,6 +34,15 @@ module Flexirest
33
34
  end
34
35
  end
35
36
 
37
+ def delete(key)
38
+ key = find_existing(key)
39
+ @store.delete(key)
40
+ end
41
+
42
+ def keys
43
+ @store.keys
44
+ end
45
+
36
46
  private
37
47
 
38
48
  def find_existing(key)
@@ -1,3 +1,3 @@
1
1
  module Flexirest
2
- VERSION = "1.5.5"
2
+ VERSION = "1.5.6"
3
3
  end
@@ -327,7 +327,14 @@ describe Flexirest::Base do
327
327
  stub_request(:get, "http://api.example.com/v1").
328
328
  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\//}).
329
329
  to_return(status: 200, body: "", headers: {})
330
- EmptyExample._request("http://api.example.com/v1", :get, {}, {headers: {"X-Something": "foo/bar"}})
330
+ EmptyExample._request("http://api.example.com/v1", :get, {}, {headers: {"X-Something" => "foo/bar"}})
331
+ end
332
+
333
+ it "passes headers if the response is unparsed" do
334
+ stub_request(:get, "http://api.example.com/v1").
335
+ 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\//}).
336
+ to_return(status: 200, body: "", headers: {})
337
+ EmptyExample._plain_request("http://api.example.com/v1", :get, {}, {headers: {"X-Something" => "foo/bar"}})
331
338
  end
332
339
 
333
340
  it "runs callbacks as usual" do
@@ -9,6 +9,13 @@ describe Flexirest::HeadersList do
9
9
  expect(headers_list["X-My-Header"]).to eq(url)
10
10
  end
11
11
 
12
+ it "should allow deleting stored headers" do
13
+ url = "http://www.google.com"
14
+ headers_list.delete("X-My-Header")
15
+ expect(headers_list["X-My-Header"]).to eq(nil)
16
+ expect(headers_list.keys).to_not include("X-My-Header")
17
+ end
18
+
12
19
  it "should remember overwrite normal headers" do
13
20
  url = "http://www.google.com"
14
21
  headers_list["X-My-Header"] = "SHOULD NEVER BE SEEN"
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.5.5
4
+ version: 1.5.6
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-11-21 00:00:00.000000000 Z
11
+ date: 2018-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler