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 Regexp expectation on request with nil base_url #431

Merged
merged 1 commit into from
Feb 16, 2015

Conversation

fnordfish
Copy link
Contributor

At the moment, Typhoeus throws an exception when stubbing using Regexp and trying to run a Request with nil as base url.

Usually a Request with nil as url simply returns an error Response

Typhoeus::Request.new(nil).run
# => #<Typhoeus::Response:0x007f2c35d3d728 ...>

Creating a Regexp stub and running a Request with nil:

Typhoeus.stub(/.*/).and_return(Typhoeus::Response.new(code: 200, body: "Typhoeus rocks"))
Typhoeus::Request.new(nil).run
# NoMethodError: undefined method `match' for nil:NilClass

@hanshasselberg
Copy link
Member

Thank you very much for your work @fnordfish!

hanshasselberg added a commit that referenced this pull request Feb 16, 2015
Fix Regexp expectation on request with nil base_url
@hanshasselberg hanshasselberg merged commit b0e2ecf into typhoeus:master Feb 16, 2015
@fnordfish
Copy link
Contributor Author

You are very welcome!

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.

2 participants