[Webkit-unassigned] [Bug 207446] New: Web Inspector: request interception

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Feb 9 16:06:13 PST 2020


https://bugs.webkit.org/show_bug.cgi?id=207446

            Bug ID: 207446
           Summary: Web Inspector: request interception
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: All
                OS: All
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Web Inspector
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: pfeldman at chromium.org
                CC: inspector-bugzilla-changes at group.apple.com

Local overrides look exciting!

As I understand, the corresponding request is still made though and I was wondering if there is any interest in intercepting requests along with the responses. That's what we typically do in automation - you often need to mock services, ads and third party content and there is no way you can send those requests over the network.

Here is what I've done for Playwright: https://github.com/pavelfeldman/webkit/commit/7a22960724114e2ba1d850515b1cd7360c524ca2 and I'd be happy to see it upstream in a shape and form that makes sense to you. The changes themselves are very local as seen in the patch, note that I've followed up and polished it in some subsequent patches. It should still give you a great idea on the changes necessary.

Here is what happened to the protocol. If you are interested in seeing it upstream, that's what we would need to discuss first. Looking forward to your response!

Network domain commands:
{
    "name": "setInterceptionEnabled",
    "description": "Enable interception of network requests.",
    "parameters": [
        { "name": "enabled", "type": "boolean" },
        { "name": "interceptRequests", "type": "boolean", "optional": true }
    ]
},
{
    "name": "interceptContinue",
    "description": "Continue an interception with no modifications.",
    "parameters": [
        { "name": "requestId", "$ref": "RequestId", "description": "Identifier for the intercepted Network request or response to continue." },
        { "name": "method", "type": "string", "optional": true,"description": "HTTP request method to use for this request" },
        { "name": "headers", "$ref": "Headers", "optional": true, "description": "HTTP response headers to use instead of the original ones for request" },
        { "name": "postData", "type": "string", "optional": true, "description": "HTTP post data to use instead of the original ones for request" }
    ]
},
{
    "name": "interceptAsError",
    "description": "Abort the intercepted request with a given reason.",
    "parameters": [
        { "name": "requestId", "$ref": "RequestId", "description": "Identifier for the intercepted Network request." },
        { "name": "reason", "type": "string", "description": "Deliver error reason for the request." }
    ]
},
{
    "name": "interceptWithResponse",
    "description": "Provide response content for an intercepted request without making the network call.",
    "parameters": [
        { "name": "requestId", "$ref": "RequestId", "description": "Identifier for the intercepted Network request to modify." },
        { "name": "content", "type": "string", "optional": true },
        { "name": "base64Encoded", "type": "boolean", "optional": true, "description": "True, if content was sent as base64." },
        { "name": "mimeType", "type": "string", "optional": true, "description": "MIME Type for the data." },
        { "name": "status", "type": "integer", "optional": true, "description": "HTTP response status code. Pass through original values if unmodified." },
        { "name": "statusText", "type": "string", "optional": true, "description": "HTTP response status text. Pass through original values if unmodified." },
        { "name": "headers", "$ref": "Headers", "optional": true, "description": "HTTP response headers. Pass through original values if unmodified." }
    ]
}

Network domain events:

{
    "name": "requestIntercepted",
    "description": "Fired when HTTP request has been intercepted. The frontend must response with <code>Network.interceptWithError</code>, <code>Network.interceptContinue</code> or <code>Network.interceptWithRespons</code>` to proceed with this response.",
    "parameters": [
        { "name": "requestId", "$ref": "RequestId", "description": "Identifier for this intercepted network. Corresponds with an earlier <code>Network.requestWillBeSent</code>." },
        { "name": "request", "$ref": "Request", "description": "Original request content that would proceed if this is continued as is." }
    ]
}

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20200210/7363ab35/attachment.htm>


More information about the webkit-unassigned mailing list