restforce 0.0.5 → 0.0.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.
Potentially problematic release.
This version of restforce might be problematic. Click here for more details.
@@ -7,11 +7,13 @@ module Restforce
|
|
7
7
|
class Middleware::Authentication < Restforce::Middleware
|
8
8
|
|
9
9
|
def call(env)
|
10
|
+
request_body = env[:body]
|
10
11
|
begin
|
11
12
|
return authenticate! if force_authenticate?(env)
|
12
13
|
@app.call(env)
|
13
14
|
rescue Restforce::UnauthorizedError
|
14
15
|
authenticate!
|
16
|
+
env[:body] = request_body
|
15
17
|
@app.call(env)
|
16
18
|
end
|
17
19
|
end
|
data/lib/restforce/version.rb
CHANGED
@@ -27,12 +27,13 @@ describe Restforce::Middleware::Authentication do
|
|
27
27
|
|
28
28
|
context 'when an exception is thrown' do
|
29
29
|
before do
|
30
|
-
|
31
|
-
middleware.should_receive(:authenticate!)
|
32
|
-
app.should_receive(:call).once
|
30
|
+
env[:body] = 'foo'
|
33
31
|
end
|
34
32
|
|
35
33
|
it 'attempts to authenticate' do
|
34
|
+
app.should_receive(:call).once { |env| env[:body] = 'bar'; raise Restforce::UnauthorizedError.new('something bad') }
|
35
|
+
middleware.should_receive(:authenticate!)
|
36
|
+
app.should_receive(:call).with(:body => 'foo').once
|
36
37
|
middleware.call(env)
|
37
38
|
end
|
38
39
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: restforce
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-09-
|
12
|
+
date: 2012-09-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|