flexirest 1.5.5 → 1.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/lib/flexirest/headers_list.rb +10 -0
- data/lib/flexirest/version.rb +1 -1
- data/spec/lib/base_spec.rb +8 -1
- data/spec/lib/headers_list_spec.rb +7 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b93954670ad807a5d5fd425e8dc837e6fc12391
|
4
|
+
data.tar.gz: dea19725cce211d236ccf111fecf8853ca5a1ff8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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)
|
data/lib/flexirest/version.rb
CHANGED
data/spec/lib/base_spec.rb
CHANGED
@@ -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"
|
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.
|
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:
|
11
|
+
date: 2018-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|