Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Differentiate request vs. response body #848

Closed
wants to merge 1 commit into from

Conversation

mislav
Copy link
Contributor

@mislav mislav commented Feb 19, 2019

After status has been written for the first time, treat env[:body] as response body and save the previous value as request body.

$ RUBYLIB=./lib irb -rfaraday
>> env = Faraday::Env.from :body => 'REQUEST'
>> p env.request_body; env.response_body
"REQUEST"
nil
>> env[:status] = 200
>> env[:body] = 'RESPONSE'
>> p env.request_body; env.response_body
"REQUEST"
"RESPONSE"

After `status` has been written for the first time, treat `env[:body]`
as response body and save the previous value as request body.
@iMacTia
Copy link
Member

iMacTia commented Feb 20, 2019

Closing in favour of #847 which expands on this

@iMacTia iMacTia closed this Feb 20, 2019
@iMacTia iMacTia deleted the request-response-body branch February 20, 2019 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants