Issue metadata
Sign in to add a comment
|
Intercept requests over devtools protocol in headless Chrome
Reported by
fastest...@gmail.com,
Feb 21 2017
|
||||||||||||||||||||||
Issue descriptionAs mentioned in the headless-dev group: https://groups.google.com/a/chromium.org/d/msg/headless-dev/uht9BW6suA8/Vanh_n9RDgAJ I'd like to be able to intercept and reply to requests via the Chrome Devtools Protocol. While writing my own C++ library is possible, I would prefer to use the Node.js library I'm already using rather than learn C++ and the Chromium internals. Being able to intercept and reply to requests would allow us to make our tests more predictable by ensuring that all third-party calls and responses are predictable and don't actually hit third-party servers.
,
Feb 21 2017
Does the webRequest API work for you? I think you can redirect to data url with whatever content is requried. https://developer.chrome.com/extensions/webRequest
,
Feb 21 2017
That was an option I looked into but I wasn't sure how redirecting to a data uri will affect CORS, iFrame origin, and how it could work for non-200 statuses.
,
Feb 21 2017
Did you consider running the browser against proxy for the testing purposes?
,
Feb 21 2017
Yeah what we're debating doing in the near-term is running headless chrome with something like: "--allow-running-insecure-content --reduce-security-for-testing --proxy-server 127.0.0.1:8800". But we haven't figured out how much the broken SSL will affect us, especially when it comes to HSTS-preloaded sites.
,
Mar 16 2017
,
May 15 2017
,
Jun 23 2017
This is now available.
,
Aug 25 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/241c6b4df3f4c0b93d783ed2b5b8b448e4e2d285 commit 241c6b4df3f4c0b93d783ed2b5b8b448e4e2d285 Author: Nathan Bruer <allada@chromium.org> Date: Fri Aug 25 15:40:12 2017 [Devtools] Request interception will now forwards based on patterns. Changed protocol to now use pattern matching to forward only requests that match a pattern provided over protocol instead of all requests. This should increase the stalled speed a bit. R=dgozman,caseq,pfeldman BUG= 752617 , 702384 , 694547 Change-Id: I4df44475023c9d275bb6818f4270620945d0c7bd Reviewed-on: https://chromium-review.googlesource.com/602483 Commit-Queue: Blaise Bruer <allada@chromium.org> Reviewed-by: Dmitry Gozman <dgozman@chromium.org> Cr-Commit-Position: refs/heads/master@{#497419} [modify] https://crrev.com/241c6b4df3f4c0b93d783ed2b5b8b448e4e2d285/content/browser/devtools/devtools_url_request_interceptor.cc [modify] https://crrev.com/241c6b4df3f4c0b93d783ed2b5b8b448e4e2d285/content/browser/devtools/devtools_url_request_interceptor.h [modify] https://crrev.com/241c6b4df3f4c0b93d783ed2b5b8b448e4e2d285/content/browser/devtools/protocol/network_handler.cc [modify] https://crrev.com/241c6b4df3f4c0b93d783ed2b5b8b448e4e2d285/content/browser/devtools/protocol/network_handler.h [modify] https://crrev.com/241c6b4df3f4c0b93d783ed2b5b8b448e4e2d285/content/public/test/test_browser_context.cc [modify] https://crrev.com/241c6b4df3f4c0b93d783ed2b5b8b448e4e2d285/content/public/test/test_browser_context.h [add] https://crrev.com/241c6b4df3f4c0b93d783ed2b5b8b448e4e2d285/third_party/WebKit/LayoutTests/http/tests/inspector-protocol/network/request-interception-patterns-expected.txt [add] https://crrev.com/241c6b4df3f4c0b93d783ed2b5b8b448e4e2d285/third_party/WebKit/LayoutTests/http/tests/inspector-protocol/network/request-interception-patterns.js [add] https://crrev.com/241c6b4df3f4c0b93d783ed2b5b8b448e4e2d285/third_party/WebKit/LayoutTests/http/tests/inspector-protocol/network/resources/small-test-1.txt [add] https://crrev.com/241c6b4df3f4c0b93d783ed2b5b8b448e4e2d285/third_party/WebKit/LayoutTests/http/tests/inspector-protocol/network/resources/small-test-2.txt [modify] https://crrev.com/241c6b4df3f4c0b93d783ed2b5b8b448e4e2d285/third_party/WebKit/Source/core/inspector/browser_protocol.json [modify] https://crrev.com/241c6b4df3f4c0b93d783ed2b5b8b448e4e2d285/third_party/WebKit/Source/devtools/front_end/sdk/NetworkManager.js |
|||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||
Comment 1 by skyos...@chromium.org
, Feb 21 2017Status: Available (was: Unconfirmed)