Repository navigation
Recognize HTTP URI schemes without regard to case - #3665
Conversation
velo
left a comment
There was a problem hiding this comment.
Checked against master: isAbsolute, HardCodedTarget and EmptyTarget now share one case-insensitive check, and the tests fail on master and pass here. Nit, not blocking: like the old check, this is a prefix match, so a relative uri() literal that starts with 'HTTP' without a leading slash is now rejected as absolute, the same way a lowercase 'http' one already was. Matching 'http://' or 'https://' would be tighter, but that can come in a follow-up.
|
Approved, and auto-merge is enabled. It now conflicts with master, but only in CHANGELOG.md, because master already has a |
Signed-off-by: Marvin Froeder <velo.br@gmail.com> # Conflicts: # CHANGELOG.md
|
Merged master; CHANGELOG.md was removed from the repo so the entry was dropped. |
A client targeting
HTTP://hostcurrently fails withtarget values must be absolute, even though the URI has an HTTP scheme. The same check affectsHTTPSand mixed-case schemes. Fixing the template check alone still letsHardCodedTargetreplace a per-request URI with the configured default target, whileEmptyTargetcontinues to reject it.Use a case-insensitive prefix check in
UriUtils.isAbsolute, and share it with both target implementations. The scheme spelling is preserved in the request URL.Regression coverage includes real requests to MockWebServer through a configured target, a per-request URI override, and an empty target, with lowercase, uppercase, and mixed-case HTTP schemes. Template tests also cover uppercase and mixed-case HTTP/HTTPS targets with paths, queries, and fragments, and ensure that absolute URLs are rejected by the relative-URI setter.
Validation:
clean installwith-Pdev -pl core -am, using JDK 8 for production sources and JDK 25 for tests: 783 tests, no failures or errors, 4 skips. Mockito was supplied as a premain Java agent for this environment.