fix(provider-webdriver): send an empty JSON object on bodyless POSTs

Merged
OK
2mo ago
+48-2

Summary

back failed on every AWS Device Farm session with Device Farm's 1 validation error detected: Value null at 'payload' failed to satisfy constraint: Member must not be null. The WebDriver transport sent POST /session/:id/back with no body. The W3C protocol makes every POST body a JSON object, and Device Farm's remote access gateway enforces that in front of Appium, while Appium itself accepts either.

WebDriverTransport now sends {} for a POST with no parameters, with Content-Type: application/json. GET and DELETE stay bodyless. One production file, one test file.

agent-device connect aws-device-farm --platform android --aws-project-arn <arn> --aws-device-arn <arn> --aws-app-arn <arn>
agent-device open com.example.app
agent-device back

Validation

Tested commit: 6019584.

  • pnpm check:affected --run on 6019584: all runnable checks passed (122 files, 773 tests).
  • New transport test: a local driver records that POST arrives with body {} and a JSON content type while DELETE and GET arrive without a body.
  • Live: this branch's build against a Google Pixel 8 (Android 15) on AWS Device Farm, connect aws-device-farm then open dev.e2e.benchmark, click @e19, back, back. Both back requests finished status: ok in the session request log (request.finished, command: back, 1262 ms and 608 ms). Before the change the same command failed with the Device Farm validation error above on agent-device 0.21.20.
  • Not covered live: BrowserStack and Limrun, which accepted bodyless POSTs before and accept {} per the W3C protocol.