Skip to content

change gridProxyDetails request from GET to POST method#14431

Merged
christian-bromann merged 1 commit intowebdriverio:mainfrom
ArtMathArt:main
Apr 28, 2025
Merged

change gridProxyDetails request from GET to POST method#14431
christian-bromann merged 1 commit intowebdriverio:mainfrom
ArtMathArt:main

Conversation

@ArtMathArt
Copy link
Contributor

Proposed changes

This PR fixes a bug related to the browser.gridProxyDetails command:

file:///<system_path>/wdio-gridproxydetails-bug/node_modules/webdriver/build/node.js:1758
      throw new WebDriverRequestError(err, url, opts);
            ^

WebDriverRequestError: WebDriverError: Request with GET/HEAD method cannot have body. when running "http://localhost:4444/grid/api/proxy" with method "GET" and args "{"id":"http://<ip_address>:64012"}"
    at FetchRequest._libRequest (file:///<system_path>/wdio-gridproxydetails-bug/node_modules/webdriver/build/node.js:1758:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async FetchRequest._request (file:///<system_path>/wdio-gridproxydetails-bug/node_modules/webdriver/build/node.js:1768:20)      
    at async Browser.wrapCommandFn (file:///<system_path>/wdio-gridproxydetails-bug/node_modules/@wdio/utils/build/index.js:907:23)    
    at async file:///<system_path>/wdio-gridproxydetails-bug/index.js:26:30

You can see the issue reproduced in this GitHub Actions pipeline:
https://github.com/ArtMathArt/wdio-gridproxydetails-bug/actions/runs/14706091466/job/41266809797#step:8:101
or using the minimal reproducible example repository:
https://github.com/ArtMathArt/wdio-gridproxydetails-bug

The issue occurs because the undici library does not accept a body in GET requests, as explained here:
nodejs/undici#4013

Since Selenium Grid 3 also supports POST requests for this endpoint (selenium-grid2-api documentation),
I propose switching the request method from GET to POST.

The changes were tested and verified in the following GitHub Actions pipeline:
https://github.com/ArtMathArt/wdio-gridproxydetails-bug/actions/runs/14707097026/job/41270124569#step:11:92

In this pipeline, a custom version of wdio-protocols was built from my fork with the proposed updates and used for testing to confirm the fix.

Types of changes

  • Polish (an improvement for an existing feature)
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update (improvements to the project's docs)
  • Specification changes (updates to WebDriver command specifications)
  • Internal updates (everything related to internal scripts, governance documentation and CI files)

Checklist

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have added the necessary documentation (if appropriate)
  • I have added proper type definitions for new commands (if appropriate)

Backport Request

//: # (The current main branch is the development branch for WebdriverIO v9. If your change should be released to the current major version of WebdriverIO (v8), please raise another PR with the same changes against the v8 branch.)

  • This change is solely for v9 and doesn't need to be back-ported
  • Back-ported PR at #XXXXX

Further comments

Thank you for reviewing this PR!
If any improvements or adjustments are needed, I'm happy to update it based on your feedback.
I'm excited to contribute to WebdriverIO and really appreciate your work maintaining this great project.

Reviewers: @webdriverio/project-committers

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Apr 28, 2025

CLA Signed


The committers listed above are authorized under a signed CLA.

Copy link
Member

@christian-bromann christian-bromann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM 👍

@christian-bromann christian-bromann added the PR: Spec Compliancy 👓 PRs that contain changes to the protocol specs label Apr 28, 2025
@christian-bromann christian-bromann merged commit 275f8d4 into webdriverio:main Apr 28, 2025
3 checks passed
@wdio-bot
Copy link
Contributor

Hey ArtMathArt 👋

Thank you for your contribution to WebdriverIO! Your pull request has been marked as an "Expensable" contribution.

We've sent you an email with further instructions on how to claim your expenses from our development fund.
Please make sure to check your spam folder as well. If you have any questions, feel free to reach out to us at expense@webdriver.io or in the contributing channel on Discord.

We are looking forward to more contributions from you in the future 🙌

Have a nice day,
The WebdriverIO Team 🤖

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Expensable $15 💸 PR: Spec Compliancy 👓 PRs that contain changes to the protocol specs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants