[Feature Request] Proxies mocking support
See original GitHub issueIs there a way to mock a proxied request?
Something in the false line of:
@mock_proxies("proxy_server_ip:port")
def test_my_responses_tester():
pass
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Developers - [Feature Request] Proxies mocking support -
Is there a way to mock a proxied request? Something in the false line of: @mock_proxies("proxy_server_ip:port") def test_my_responses_tester(): pass.
Read more >Partial API mocking with proxy mode - Mockoon
Partially mock APIs using the proxy mode. Mockoon supports partial mocking of an API endpoints by forwarding the requests that does not match...
Read more >Prism | Open-Source HTTP Mock and Proxy Server - Stoplight
Prism, an Open-Source HTTP Mock & Proxy Server. Accelerate API development with realistic mock servers, powered by OpenAPI documents.
Read more >RspecProxies | Simplify Rspec mocking with test proxies !
RSpec now features minimal supports for proxies with partial mocks, spies and the and_call_original and and_wrap_original expectations.
Read more >Requestly - Lightweight Proxy to Intercept & Modify HTTP(s ...
Requestly allows you to Intercept & Modify network requests. Main features include Mocking APIs Response, Modifying headers, Setting up redirects, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Could you provide a basic example on how to achieve this?
@LucaCappelletti94 @thehappydinoa can you please provide a minimal reproducible of desired behaviour?
don’t think example provided by @asfaltboy will work. Proxied request is not just a change of the URL destination. when we set a proxy, then HTTPConnection is established to the required proxy server, while destination of the URL (eg http://example.com) is preserved.
That basically means, that proxy is served on the lower level compared to
requests.adapters
and from user perspective it looks identical if request is sent with/without proxy. Let’s assume your proxy server changes content of the response (eg filters data), then you can just addresponses.Response
with required content. Next, you need to ensure, that actually proxy was applied, then you can just use matchers.request_kwargs_matcher and check that proxies were suppliedI would be glad to discuss the topic based on an example you provide
CC: @markstory