technoweenie/faraday — pull request #168 by myronmarston (2012-06-13 05:55:49+00:00)
Title: Empty response body consistency

Zero-byte response bodies can be represented as either nil or '' in ruby.
Most ruby HTTP clients use '' (which, conveniently, allows clients
to assume the body is always a string), but Net::HTTP, for whatever
reason, uses nil.

This change makes it so that all faraday adapters consistently return
'' for zero-byte response bodies.

On a side note: I'm getting a couple of test failures, even before making my changes:

```
1) Error:
test_POST_sends_files(Adapters::ExconTest):
Faraday::Error::ClientError: the server responded with status 400
/Users/myron/code/faraday/lib/faraday/response/raise_error.rb:8:in `on_complete'
/Users/myron/code/faraday/lib/faraday/response.rb:9:in `block in call'
/Users/myron/code/faraday/lib/faraday/response.rb:63:in `on_complete'
/Users/myron/code/faraday/lib/faraday/response.rb:8:in `call'
/Users/myron/code/faraday/lib/faraday/request/url_encoded.rb:14:in `call'
/Users/myron/code/faraday/lib/faraday/request/multipart.rb:13:in `call'
/Users/myron/code/faraday/lib/faraday/connection.rb:399:in `run_request'
/Users/myron/code/faraday/lib/faraday/connection.rb:196:in `post'
/Users/myron/code/faraday/test/adapters/integration.rb:110:in `test_POST_sends_files'

2) Failure:
test_PATCH_send_url_encoded_params(Adapters::TyphoeusTest) [/Users/myron/code/faraday/test/adapters/integration.rb:130]:
<"patch {\"name\"=>\"zack\"}"> expected but was
<"patch ?{\"name\"=>\"zack\"}">.
```