selenium
selenium copied to clipboard
[java] case insensitive header names in http requests
User description
Thanks for contributing to Selenium! A PR well described will help maintainers to quickly review and merge it
Before submitting your PR, please check our contributing guidelines. Avoid large PRs, help reviewers by making them as simple and short as possible.
Description
I opened PR with initial changes. i have already asked some questions about feature in feature request ticket I will implement new tests as soon as I get more information about task details
Motivation and Context
according to #12697 I started to discover how to implement this feature
Types of changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist
- [x] I have read the contributing document.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
PR Type
Enhancement
Description
- Normalize header names to lowercase in
setHeadermethod to ensure case-insensitive handling. - Normalize header names to lowercase in
addHeadermethod to ensure case-insensitive handling.
Changes walkthrough 📝
| Relevant files | |||
|---|---|---|---|
| Enhancement |
|
💡 PR-Agent usage: Comment
/helpon the PR to get a list of all available PR-Agent tools and their descriptions
PR Review 🔍
| ⏱️ Estimated effort to review [1-5] |
2, because the changes are limited to a few lines in a single file, modifying header handling to be case-insensitive. The logic is straightforward, but the impact on existing functionality should be carefully evaluated. |
| 🧪 Relevant tests |
No |
| ⚡ Possible issues |
Consistency Issue: The PR changes headers to be stored in lowercase, which might affect other parts of the system that rely on the original case format of headers. |
| 🔒 Security concerns |
No |
PR Code Suggestions ✨
| Category | Suggestion | Score |
| Possible bug |
Add a null check for the
| 8 |
| Best practice |
Use
| 7 |
Let's at least wait to merge this after the upcoming release so that Appium can run their tests against nightly and see if it causes them problems before a production release.
Several tests failed. Can you please check?
@diemol sure
The FederatedCredentialManagementTest could not be executed due to a process creation error on Windows, related to the long path to the executable file. As a result, the test failed three times, despite the successful execution of other tests.
This failure occurs frequently in test runs on Windows and is not directly related to the changes in the pull request.
i found issue that can help fix it https://github.com/bazelbuild/bazel/issues/19710
I meant this ones https://github.com/SeleniumHQ/selenium/actions/runs/10321185029/job/28573474046?pr=14095
oh...i see I mentioned this in the feature request here. The failing tests need to be fixed under the assumption that headers are now case-insensitive. I will correct the existing tests and resubmit them for review.
@diemol please verify my changes in tests
I tried to preserve the logic of the checks, considering that header names are now case-insensitive. I also fixed the HttpMessage.setHeader method. Previously, it couldn't remove a header because the headers were set in lowercase, while the name was passed in an arbitrary case.
public M setHeader(String name, String value) {
return removeHeader(name.toLowerCase()).addHeader(name.toLowerCase(), value);
}
i noticed the problem with the formatting 👀
@diemol i fixed the tests with headers