faraday-cookie_jar 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/faraday-cookie_jar.gemspec +1 -1
- data/lib/faraday/cookie_jar.rb +7 -2
- data/lib/faraday/cookie_jar/version.rb +1 -1
- data/spec/faraday-cookie_jar/cookie_jar_spec.rb +11 -0
- data/spec/support/fake_app.rb +4 -0
- metadata +26 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23be36b8be03b487d50d756a69c6f3e6996a1e2f
|
4
|
+
data.tar.gz: 80be5d729297d81d752dce3c0ff65c11e6d04911
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eedf7cd419797c390d238fab7a48b198a37855653d17af0283a56f020f92587f3a31b3ebc93ab4f3769979a2b1e308d17e3c7cd88c170e9b24d7f4ea426f8e6e
|
7
|
+
data.tar.gz: 05c368592c7eea598722a17fb9b3cfb88d4d11f7c38d91c4c7c48d022fb06eb43e7a244ea0b51a5b1731bc419e99cfc95dd502fd92245c509bb9f6c619b5a748
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
## 0.0.5 Mon Jan 20 21:53:13 PST 2014
|
2
|
+
|
3
|
+
- Lock faraday dependency to < 0.9.0 for now
|
4
|
+
- Ability to add extra cookies in addition to the ones in Cookie Jar (nanjingboy)
|
5
|
+
|
1
6
|
## 0.0.4 Mon Aug 12 23:11:46 PDT 2013
|
2
7
|
|
3
8
|
- Fix a crash when there's no valid response header #3
|
data/faraday-cookie_jar.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency "faraday", ">= 0.7.4"
|
21
|
+
spec.add_dependency "faraday", ">= 0.7.4", "< 0.9.0"
|
22
22
|
spec.add_dependency "http-cookie", "~> 1.0.0"
|
23
23
|
|
24
24
|
spec.add_development_dependency "bundler", "~> 1.3"
|
data/lib/faraday/cookie_jar.rb
CHANGED
@@ -11,7 +11,12 @@ module Faraday
|
|
11
11
|
def call(env)
|
12
12
|
cookies = @jar.cookies(env[:url])
|
13
13
|
unless cookies.empty?
|
14
|
-
|
14
|
+
cookie_value = HTTP::Cookie.cookie_value(cookies)
|
15
|
+
if env[:request_headers]["Cookie"]
|
16
|
+
env[:request_headers]["Cookie"] = cookie_value + ';' + env[:request_headers]["Cookie"]
|
17
|
+
else
|
18
|
+
env[:request_headers]["Cookie"] = cookie_value
|
19
|
+
end
|
15
20
|
end
|
16
21
|
|
17
22
|
@app.call(env).on_complete do |res|
|
@@ -27,4 +32,4 @@ end
|
|
27
32
|
|
28
33
|
if Faraday.respond_to? :register_middleware
|
29
34
|
Faraday.register_middleware :cookie_jar => lambda { Faraday::CookieJar }
|
30
|
-
end
|
35
|
+
end
|
@@ -24,5 +24,16 @@ describe Faraday::CookieJar do
|
|
24
24
|
sleep 2
|
25
25
|
conn.get('/dump').body.should_not == 'foo=bar'
|
26
26
|
end
|
27
|
+
|
28
|
+
it 'multiple cookies' do
|
29
|
+
conn.get('/default')
|
30
|
+
|
31
|
+
response = conn.send('get') do |request|
|
32
|
+
request.url '/multiple_cookies'
|
33
|
+
request.headers.merge!({:Cookie => 'language=english'})
|
34
|
+
end
|
35
|
+
|
36
|
+
response.body.should == 'foo=bar;language=english'
|
37
|
+
end
|
27
38
|
end
|
28
39
|
|
data/spec/support/fake_app.rb
CHANGED
metadata
CHANGED
@@ -1,111 +1,117 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faraday-cookie_jar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tatsuhiko Miyagawa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 0.7.4
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.9.0
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- -
|
27
|
+
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: 0.7.4
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.9.0
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: http-cookie
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
|
-
- - ~>
|
37
|
+
- - "~>"
|
32
38
|
- !ruby/object:Gem::Version
|
33
39
|
version: 1.0.0
|
34
40
|
type: :runtime
|
35
41
|
prerelease: false
|
36
42
|
version_requirements: !ruby/object:Gem::Requirement
|
37
43
|
requirements:
|
38
|
-
- - ~>
|
44
|
+
- - "~>"
|
39
45
|
- !ruby/object:Gem::Version
|
40
46
|
version: 1.0.0
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: bundler
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
|
-
- - ~>
|
51
|
+
- - "~>"
|
46
52
|
- !ruby/object:Gem::Version
|
47
53
|
version: '1.3'
|
48
54
|
type: :development
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
51
57
|
requirements:
|
52
|
-
- - ~>
|
58
|
+
- - "~>"
|
53
59
|
- !ruby/object:Gem::Version
|
54
60
|
version: '1.3'
|
55
61
|
- !ruby/object:Gem::Dependency
|
56
62
|
name: rake
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
58
64
|
requirements:
|
59
|
-
- -
|
65
|
+
- - ">="
|
60
66
|
- !ruby/object:Gem::Version
|
61
67
|
version: '0'
|
62
68
|
type: :development
|
63
69
|
prerelease: false
|
64
70
|
version_requirements: !ruby/object:Gem::Requirement
|
65
71
|
requirements:
|
66
|
-
- -
|
72
|
+
- - ">="
|
67
73
|
- !ruby/object:Gem::Version
|
68
74
|
version: '0'
|
69
75
|
- !ruby/object:Gem::Dependency
|
70
76
|
name: rspec
|
71
77
|
requirement: !ruby/object:Gem::Requirement
|
72
78
|
requirements:
|
73
|
-
- -
|
79
|
+
- - ">="
|
74
80
|
- !ruby/object:Gem::Version
|
75
81
|
version: '0'
|
76
82
|
type: :development
|
77
83
|
prerelease: false
|
78
84
|
version_requirements: !ruby/object:Gem::Requirement
|
79
85
|
requirements:
|
80
|
-
- -
|
86
|
+
- - ">="
|
81
87
|
- !ruby/object:Gem::Version
|
82
88
|
version: '0'
|
83
89
|
- !ruby/object:Gem::Dependency
|
84
90
|
name: sinatra
|
85
91
|
requirement: !ruby/object:Gem::Requirement
|
86
92
|
requirements:
|
87
|
-
- -
|
93
|
+
- - ">="
|
88
94
|
- !ruby/object:Gem::Version
|
89
95
|
version: '0'
|
90
96
|
type: :development
|
91
97
|
prerelease: false
|
92
98
|
version_requirements: !ruby/object:Gem::Requirement
|
93
99
|
requirements:
|
94
|
-
- -
|
100
|
+
- - ">="
|
95
101
|
- !ruby/object:Gem::Version
|
96
102
|
version: '0'
|
97
103
|
- !ruby/object:Gem::Dependency
|
98
104
|
name: sham_rack
|
99
105
|
requirement: !ruby/object:Gem::Requirement
|
100
106
|
requirements:
|
101
|
-
- -
|
107
|
+
- - ">="
|
102
108
|
- !ruby/object:Gem::Version
|
103
109
|
version: '0'
|
104
110
|
type: :development
|
105
111
|
prerelease: false
|
106
112
|
version_requirements: !ruby/object:Gem::Requirement
|
107
113
|
requirements:
|
108
|
-
- -
|
114
|
+
- - ">="
|
109
115
|
- !ruby/object:Gem::Version
|
110
116
|
version: '0'
|
111
117
|
description: Cookie jar middleware for Faraday
|
@@ -115,7 +121,7 @@ executables: []
|
|
115
121
|
extensions: []
|
116
122
|
extra_rdoc_files: []
|
117
123
|
files:
|
118
|
-
- .gitignore
|
124
|
+
- ".gitignore"
|
119
125
|
- CHANGELOG.md
|
120
126
|
- Gemfile
|
121
127
|
- LICENSE.txt
|
@@ -138,17 +144,17 @@ require_paths:
|
|
138
144
|
- lib
|
139
145
|
required_ruby_version: !ruby/object:Gem::Requirement
|
140
146
|
requirements:
|
141
|
-
- -
|
147
|
+
- - ">="
|
142
148
|
- !ruby/object:Gem::Version
|
143
149
|
version: '0'
|
144
150
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
145
151
|
requirements:
|
146
|
-
- -
|
152
|
+
- - ">="
|
147
153
|
- !ruby/object:Gem::Version
|
148
154
|
version: '0'
|
149
155
|
requirements: []
|
150
156
|
rubyforge_project:
|
151
|
-
rubygems_version: 2.
|
157
|
+
rubygems_version: 2.1.11
|
152
158
|
signing_key:
|
153
159
|
specification_version: 4
|
154
160
|
summary: Manages client-side cookie jar for Faraday HTTP client
|