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

wrong response code/message when stubbing request from curl-generated file #12

Closed
arvicco opened this issue Feb 2, 2010 · 4 comments
Closed

Comments

@arvicco
Copy link

arvicco commented Feb 2, 2010

I'm stubbing request to return response from file harvested with curl:
stub_request(:get, "www.example.com").to_return(File.new('/path/to/curl/stub/file'))

Then I'm making the request:
resp = Net::HTTP.get('www.example.com', '/')

Unfortunately, resp.code is always returned as 200 and resp.message as "", even though stub file has correct status code/message as a first line:

HTTP/1.1 404 Not Found,
or
HTTP/1.1 302 Found

@bblimke
Copy link
Owner

bblimke commented Feb 2, 2010

Hi.

Thanks for reporting this. I forgot about the status code completely.
It's fixed in master now and I will try to create a patch release today.

@arvicco
Copy link
Author

arvicco commented Feb 3, 2010

Status codes seem to be fixed in 0.9.1, however I'm still getting empty message - it would be good to stub it from first line as well - just to have stubbed response closely mocking a real one...

@bblimke
Copy link
Owner

bblimke commented Feb 3, 2010

Yes, status messages are not supported in WebMock now.
It will be a small change so I can add it to the next release.

@bgreenlee
Copy link

Status messages++

This issue was closed.
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

No branches or pull requests

3 participants