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

Assert that a request was made via a proxy server #753

Open
mikebaldry opened this issue Mar 22, 2018 · 4 comments
Open

Assert that a request was made via a proxy server #753

mikebaldry opened this issue Mar 22, 2018 · 4 comments

Comments

@mikebaldry
Copy link

I'm looking to write a test that ensures a http request happened, via a certain proxy server.

I can't seem to see any way to do that. Is it something you'd consider adding?

stub_request(:post, "www.example.com").
  with(body: /world$/, headers: {"Content-Type" => /image\/.+/}, proxy: "http://myproxy.com").
  to_return(body: "abc")

perhaps?

@asoong
Copy link

asoong commented Apr 9, 2018

+1

@bblimke
Copy link
Owner

bblimke commented Apr 29, 2018

@mikebaldry thank you for your suggestion. It sounds like a useful feature. It will have to wait though, unless someone submits a pull request with support for proxy.

joshcooper added a commit to joshcooper/puppet that referenced this issue Dec 3, 2019
Use webmock to stub forge requests.

Eliminate duplicated tests that were run in proxy and authenticating proxy
contexts. Instead add explicit tests for those two cases, since the only
difference is calling `Net::HTTP` with different arguments. Ideally proxy
behavior could be tested via webmock, but it isn't supported yet[1].

Add test for when path does not start with forward slash.

Add missing tests for basic authentication and PE license.

Fix broken user-agent test. Previously the request just needed to match one of
the stubbed requests, not all three.

[1] bblimke/webmock#753
joshcooper added a commit to joshcooper/puppet that referenced this issue Dec 3, 2019
Use webmock to stub forge requests.

Eliminate duplicated tests that were run in proxy and authenticating proxy
contexts. Instead add explicit tests for those two cases, since the only
difference is calling `Net::HTTP` with different arguments. Ideally proxy
behavior could be tested via webmock, but it isn't supported yet[1].

Add test for when path does not start with forward slash.

Add missing tests for basic authentication and PE license.

Fix broken user-agent test. Previously the request just needed to match one of
the stubbed requests, not all three.

[1] bblimke/webmock#753
@juliofalbo
Copy link

Any news about it?

@bblimke
Copy link
Owner

bblimke commented Nov 18, 2020

I'm not aware of anyone working or planning to work on adding support for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants