-
Notifications
You must be signed in to change notification settings - Fork 6
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
recording over HTTPS #366
Comments
Hey ! Thanks for the kind words. Without further investigation I'm clueless. The standalone recorder is using warp-reverse-proxy so I bet there's some warp config to tweak in order to accept self-signed (or even ignore) certificates. That being said it's not a being deal, there's a better option. This recorder is more aimed to be used standalone in the cli. Since you are using reqwest there's also a direct integration. You can have an example of it here. It has the drawback of requiring a reqwest ClientBuilder (only way to read both request & response) so you'd maybe have to rewrite your tests a bit. It it also only implemented for blocking ; but implementing it for async should be straightforward. Let me know if that works out for you 😉 |
Thanks for the info. I'll try that tomorrow. I just had a look over the source code, and I think I figured out what was happening: warp-reverse-proxy is initiated here: https://github.com/indietyp/stubr/blob/main/lib/src/record/standalone/proxy.rs#L20 And warp-reverse-proxy initializes a static reqwest client: https://github.com/danielSanchezQ/warp-reverse-proxy/blob/master/src/lib.rs#L53, so my suggestion is a setting where you can set the client because default reqwest (which is the one that gets initialized - https://github.com/danielSanchezQ/warp-reverse-proxy/blob/master/src/lib.rs#L274) does not support self-signed certificates. I'll also try tomorrow if that would be a potential solution - and if you are up for it - I'd be happy to create a PR with the necessary changes. |
I have been doing some experimentation (HTTPS proxies are kind of a new thing to me^^), and supporting HTTPS is a bit more involved due to the use of |
I found kind of a workaround, which forces HTTP: deploy mitmproxy: |
A little too complicated indeed. |
Yes, kind of. I would need to implement |
No it's only sent once: |
I have been using stubr in my tests and wanted to switch to using the recording for more automated mocking.
My current problem is that I am trying to use the reqwest integration in conjunction with a test server with a self-signed certificate. Whenever I try to connect over TLS I get: "Http(reqwest::Error { kind: Request, url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("...")), port: None, path: "/api/v2/auth/login", query: None, fragment: None }, source: hyper::Error(Connect, "unsuccessful tunnel") })" when using the proxy. (which is to be expected)
How would I be able to fix the problem?
Thanks for the great library, btw!
The text was updated successfully, but these errors were encountered: