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

Is there any way can stub HTTP request in mechanize? #490

Closed
tsaohucn opened this issue Apr 28, 2017 · 1 comment
Closed

Is there any way can stub HTTP request in mechanize? #490

tsaohucn opened this issue Apr 28, 2017 · 1 comment

Comments

@tsaohucn
Copy link

I use webmock to stub HTTP request in mechanize, but it looks like incompatible, is there any way can stub HTTP request in mechanize?

@kinopyo
Copy link

kinopyo commented Jul 11, 2017

@tsaohucn Any chance you were missing a header when stubbing with webmock? 🙂 The example below is compatible with mechanize.

stub_request(:get, "http://example.com").to_return(
  status: 200,
  body: "<title>The Title</title>...",
  headers: { "Content-Type" => "text/html" }
)

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