w3c / webdriver-bidi

Bidirectional WebDriver protocol for browser automation
https://w3c.github.io/webdriver-bidi/
336 stars 35 forks source link

Network Intercept: continue response: specifying only "status" or "headers" #572

Open thiagowfx opened 9 months ago

thiagowfx commented 9 months ago

I just learned that CDP does not support executing "continue response" with only one of either status or headers (c.f. here) i.e. both should be provided.

This prompted me to file this issue to request clarification w.r.t. the spec. The questions are:

  1. Is this the desired behavior? If yes, then we should add an assertion to the spec, and possibly throw "invalid argument" in this scenario.
  2. If no, then what should be remote behavior be? The most straightforward one seems to reuse the pre-existing value. For example: If the client tries to continue response with a custom header, then we automatically populate the status code value to what it would be had the response not been intercepted. And vice-versa in case there's a status code but not a header.

What is the correct intended / expected behavior here?

cc @juliandescottes @jgraham

thiagowfx commented 9 months ago

cc @sadym-chromium

sadym-chromium commented 9 months ago

I read the spec as "if user don't specify status or headers, the ones from the original response should be provided". And from the implementation side we should already have the original response status and headers at the point of the response intercepted, so if we want to override only one of them, we provide another with the original value.

I'm not sure what is the question.

thiagowfx commented 9 months ago

This is basically 2). OK. Let me wait for a few more days to see if anyone disagrees.

sadym-chromium commented 9 months ago

This is basically 2). OK. Let me wait for a few more days to see if anyone disagrees.

Spec-wise, update the response has a response, which is not null in case of continueResponse, so the further manipulations are done on the original response and override some of the original properties, keeping other in place.