What's the best way via the debugging protocol to modify/rewrite a request and it's response? For tests, we'd like to have predictable returns from external APIs and therefore we'd like to either be able to rewrite the destination (say, to our own server) or rewrite the response body.Thanks!
--
You received this message because you are subscribed to the Google Groups "headless-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to headless-dev+unsubscribe@chromium.org.
To post to this group, send email to headle...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/headless-dev/6953e215-1ab7-42bf-a372-23d1960d1cc4%40chromium.org.
The devtools protocol doesn't really support that use case. I'd suggest one of the following options:1. Write a proxy to stub out the APIs you want to test.2. Use the C++ library and write a ProtocolHandler (e.g InMemoryProtocolHandler) to deal with http/https requests and stub things out that that level. Here's an example of crating a WebContents with a ProtocolHandler. If you want your ProtocolHandler to conditionally make real http requests, tale a look at DeterministicHttpProtocolHandler::MaybeCreateJob which uses HttpURLFetcher to fetch resources.
On 21 February 2017 at 00:46, <ja...@getadmiral.com> wrote:
What's the best way via the debugging protocol to modify/rewrite a request and it's response? For tests, we'd like to have predictable returns from external APIs and therefore we'd like to either be able to rewrite the destination (say, to our own server) or rewrite the response body.Thanks!
--
You received this message because you are subscribed to the Google Groups "headless-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to headless-dev...@chromium.org.
To post to this group, send email to headle...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/headless-dev/6953e215-1ab7-42bf-a372-23d1960d1cc4%40chromium.org.
--
You received this message because you are subscribed to the Google Groups "headless-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to headless-dev...@chromium.org.
To post to this group, send email to headle...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/headless-dev/CAPG_qM5AOQpYMkDWa3uRiUJQ1sT7L-CfwHJ3pStECWaj9hYVJg%40mail.gmail.com.
Thanks Alex. Another option would be to extend the debugging protocol to allow this. If you think that's important for your use case, please file a bug here: https://bugs.chromium.org/p/chromium/issues/entry?labels=Proj-Headless
- Sami
ti 21. helmik. 2017 klo 8.37 'Alex Clarke' via headless-dev <headle...@chromium.org> kirjoitti:
The devtools protocol doesn't really support that use case. I'd suggest one of the following options:1. Write a proxy to stub out the APIs you want to test.2. Use the C++ library and write a ProtocolHandler (e.g InMemoryProtocolHandler) to deal with http/https requests and stub things out that that level. Here's an example of crating a WebContents with a ProtocolHandler. If you want your ProtocolHandler to conditionally make real http requests, tale a look at DeterministicHttpProtocolHandler::MaybeCreateJob which uses HttpURLFetcher to fetch resources.
On 21 February 2017 at 00:46, <ja...@getadmiral.com> wrote:
What's the best way via the debugging protocol to modify/rewrite a request and it's response? For tests, we'd like to have predictable returns from external APIs and therefore we'd like to either be able to rewrite the destination (say, to our own server) or rewrite the response body.Thanks!
--
You received this message because you are subscribed to the Google Groups "headless-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to headless-dev+unsubscribe@chromium.org.
To post to this group, send email to headle...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/headless-dev/6953e215-1ab7-42bf-a372-23d1960d1cc4%40chromium.org.
--
You received this message because you are subscribed to the Google Groups "headless-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to headless-dev+unsubscribe@chromium.org.
To post to this group, send email to headle...@chromium.org.