Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BrowserStack requires charset=utf-8 in Content-Type header on Selenium >= 4 #180

Closed
lamalex opened this issue Aug 4, 2022 · 1 comment · Fixed by #183
Closed

BrowserStack requires charset=utf-8 in Content-Type header on Selenium >= 4 #180

lamalex opened this issue Aug 4, 2022 · 1 comment · Fixed by #183

Comments

@lamalex
Copy link
Contributor

lamalex commented Aug 4, 2022

Initiating a session on Selenium >= 4 requires the charset to be declared in the content type.
Although this feels like misuse on selenium's part, they seem to be dug in. See SeleniumHQ/selenium#10913.

Setting Content-Type: application/json; charset=utf-8 should not cause any breakage in existing implementations, but would expand compatibility.

@jonhoo
Copy link
Owner

jonhoo commented Aug 11, 2022

Oh interesting! That should be a straightforward enough modification here:

req = req.header(hyper::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref());

I'm super swamped for time at the moment, but happy to approve a PR!

lamalex added a commit to lamalex/fantoccini that referenced this issue Aug 11, 2022
Fixes: jonhoo#180
BrowserStack (selenium v >=4) requires the charset to be set due to some
undisclosed security vulnerability, despite technically being implied by
the JSON spec.

Adding `charset=utf-8` should not have any backward compatibility issues
with current users.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants