Skip to content

[py] translate continue_request/continue_response kwargs to BiDi wire format#17669

Merged
AutomatedTester merged 2 commits into
trunkfrom
worktree-bidi-continue-kwargs
Jun 11, 2026
Merged

[py] translate continue_request/continue_response kwargs to BiDi wire format#17669
AutomatedTester merged 2 commits into
trunkfrom
worktree-bidi-continue-kwargs

Conversation

@AutomatedTester

Copy link
Copy Markdown
Member

🔗 Related Issues

Follow-up to #17666 (both address kwargs handling in the high-level driver.network API).

💥 What does this PR do?

Fixes the high-level Request.continue_request and Response.continue_response so their keyword arguments are translated to the BiDi wire format instead of being passed through raw.

Previously both methods accepted **kwargs and merged them straight onto the wire params (params.update(kwargs)). That bypassed the snake_case → camelCase translation (statusstatusCode, reason_phrasereasonPhrase) 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 as continue_response(status=503) or continue_request(headers={...}) silently sent the wrong key or an untranslated value — only undocumented raw wire keys actually worked.

🔧 Implementation Notes

  • Replaced the **kwargs signatures with explicit, keyword-only params matching the existing set_* mutators:
    • continue_request(*, url, method, headers, cookies, body)
    • continue_response(*, status, reason_phrase, headers, cookies)
  • _continue_params now 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.
  • No internal or test caller passed kwargs to either method (every call site is argument-less), so the keyword-only signature change is safe. These are the new, not-yet-released high-level BiDi APIs.

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-unit passes.

🤖 AI assistance

  • No substantial AI assistance used
  • AI assisted (complete below)
    • Tool(s): Claude Code (Opus 4.8)
    • What was generated: the fix and its regression tests
    • I reviewed all AI output and can explain the change

🔄 Types of changes

  • Bug fix (backwards compatible)

… 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.
@selenium-ci selenium-ci added the C-py Python Bindings label Jun 11, 2026
@AutomatedTester AutomatedTester merged commit 887237c into trunk Jun 11, 2026
44 checks passed
@AutomatedTester AutomatedTester deleted the worktree-bidi-continue-kwargs branch June 11, 2026 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-py Python Bindings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants