[py] translate continue_request/continue_response kwargs to BiDi wire format#17669
Merged
Conversation
… format
The high-level Request.continue_request and Response.continue_response
accepted **kwargs and merged them straight onto the wire params. This
bypassed the snake_case to camelCase translation (status -> statusCode,
reason_phrase -> reasonPhrase) and the value encoders used everywhere
else in this layer, so pythonic calls like continue_response(status=503)
or continue_request(headers={...}) silently sent wrong or untranslated
values.
Replace the kwargs with explicit keyword-only params matching the
set_* mutators and route them through _continue_params so they are
translated uniformly while still overriding recorded mutations.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔗 Related Issues
Follow-up to #17666 (both address kwargs handling in the high-level
driver.networkAPI).💥 What does this PR do?
Fixes the high-level
Request.continue_requestandResponse.continue_responseso their keyword arguments are translated to the BiDi wire format instead of being passed through raw.Previously both methods accepted
**kwargsand merged them straight onto the wire params (params.update(kwargs)). That bypassed the snake_case → camelCase translation (status→statusCode,reason_phrase→reasonPhrase) and the value encoders (dict_to_headers,list_to_cookie_headers,_encode_bytes_value) used everywhere else in this layer. As a result, pythonic calls such ascontinue_response(status=503)orcontinue_request(headers={...})silently sent the wrong key or an untranslated value — only undocumented raw wire keys actually worked.🔧 Implementation Notes
**kwargssignatures with explicit, keyword-only params matching the existingset_*mutators:continue_request(*, url, method, headers, cookies, body)continue_response(*, status, reason_phrase, headers, cookies)_continue_paramsnow overlays the explicit overrides on top of recorded mutations and runs everything through the same translation path, so explicit args get the correct wire keys/encoding and still override recorded mutations.Added unit regression tests asserting explicit args are translated to wire format and that they override recorded mutations.
🧪 Testing
bazel test //py:test/unit/selenium/webdriver/common/bidi_network_tests-unitpasses.🤖 AI assistance
🔄 Types of changes