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

Fix Net::HTTP adapter so that it returns nil for an empty body response. #190

Merged
merged 1 commit into from
Jul 23, 2012

Conversation

myronmarston
Copy link
Collaborator

This mirrors the real behavior of Net::HTTP and is the source of myronmarston/vcr#173.

A couple things to note:

  • Rather than hitting an external URL (httpstat.us/204), this should probably
    hit the local webmock server; however, I can't figure out how to make the
    webmock server return a different response for different requests since it's
    writing directly to the socket w/o any request context available. Maybe it
    should be refactored to use rack or sinatra?
  • I have no idea why, but Curb is returning a 400 Bad Request response for
    the request. Weird. Not sure why or how to fix it.

…onse.

This mirrors the real behavior of Net::HTTP and is the source of myronmarston/vcr#173.

A couple things to note:

- Rather than hitting an external URL (httpstat.us/204), this should probably
  hit the local webmock server; however, I can't figure out how to make the
  webmock server return a different response for different requests since it's
  writing directly to the socket w/o any request context available. Maybe it
  should be refactored to use rack or sinatra?
- I have no idea why, but Curb is returning a 400 Bad Request response for
  the request. Weird. Not sure why or how to fix it.
@bblimke
Copy link
Owner

bblimke commented Jun 15, 2012

Thanks Myron. Clever approach to test that.

I'll create a patch release once I figure out what's going on with curb.

@myronmarston
Copy link
Collaborator Author

What are your thoughts on the idea of refactoring the webmock server? This spec is currently hitting an external URL, as is my spec in #185. It'd be nice to make them hit the webmock server but they need a particular response and I couldn't figure out how to conditionally return a response based on the request in your current setup.

bblimke added a commit that referenced this pull request Jul 23, 2012
Fix Net::HTTP adapter so that it returns `nil` for an empty body response.
@bblimke bblimke merged commit e015405 into master Jul 23, 2012
@davidbegin davidbegin deleted the nil_response_body branch May 10, 2015 02:56
ytuauden pushed a commit to ytuauden/linkedin-v2-oauth2 that referenced this pull request Jul 18, 2022
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