Colin-b/pytest_httpx

How can I test if the request is being proxied?

Closed this issue · 4 comments

hi,

I just wonder how to test if a request is sent via proxy,
it's not reporting CONNECT nor the request is being proxied.

Hi @DeoLeung

Right now there is no way to retrieve proxy parameters linked to a request.

  1. Is this a feature you need?
  2. I assume you would want to assert the URL used for proxy? (including credentials if any?)

Since release 0.26.0 you can now match on proxy_url (str, regex or httpx.URL), order of query parameters does not matter (even though it's unlikely you provide any to your proxy url)

thank you for the quick response!

It works, just to mention currently for the proxy_url we need to append an / at the end.

thank you for the quick response!

It works, just to mention currently for the proxy_url we need to append an / at the end.

I think this is the actual URL queried by httpx, I might be wrong though, I will check it and fix it if this is not the actual one :)