mirror of
https://github.com/lostisland/faraday.git
synced 2025-12-04 00:03:34 -05:00
Merge pull request #378 from janko-m/fix-parallel-parsing
Fix response not changing with parallel requests
This commit is contained in:
commit
4fe046e6ba
@ -61,8 +61,8 @@ module Faraday
|
||||
|
||||
def finish(env)
|
||||
raise "response already finished" if finished?
|
||||
@env = Env.from(env)
|
||||
@on_complete_callbacks.each { |callback| callback.call(env) }
|
||||
@env = Env.from(env)
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
@ -166,6 +166,14 @@ class ResponseTest < Faraday::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
def test_body_is_parsed_on_finish
|
||||
response = Faraday::Response.new
|
||||
response.on_complete { |env| env[:body] = env[:body].upcase }
|
||||
response.finish(@env)
|
||||
|
||||
assert_equal "YIKES", response.body
|
||||
end
|
||||
|
||||
def test_not_success
|
||||
assert !@response.success?
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user