Skip to content

Commit 9874e00

Browse files
authored
4.x: ClientRequestBase incorrectly rejects non-lowercase schemes #10752 (#10780)
Signed-off-by: Jorge Bescos Gascon <[email protected]>
1 parent ebd7e67 commit 9874e00

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

webclient/api/src/main/java/io/helidon/webclient/api/ClientRequestBase.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,8 @@ private static String nextRequestId(String protocolId) {
475475
}
476476

477477
private R validateAndSubmit(Object entity) {
478-
if (!SUPPORTED_SCHEMES.contains(uri().scheme())) {
478+
String scheme = uri().scheme();
479+
if (scheme == null || !SUPPORTED_SCHEMES.contains(scheme.toLowerCase())) {
479480
throw new IllegalArgumentException(
480481
String.format("Not supported scheme %s, client supported schemes are: %s",
481482
uri().scheme(),

webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/RequestedUriTest.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023 Oracle and/or its affiliates.
2+
* Copyright (c) 2023, 2025 Oracle and/or its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -75,4 +75,16 @@ void ipV6Test() {
7575
() -> assertThat(response.status(), is(Status.OK_200))
7676
);
7777
}
78+
79+
@Test
80+
void schemeCaseTest() {
81+
int port = webServer.port();
82+
WebClient client = WebClient.builder()
83+
.baseUri("hTTp://localhost:" + port)
84+
.build();
85+
ClientResponseTyped<String> response = client.get()
86+
.path("/uri")
87+
.request(String.class);
88+
assertThat(response.status(), is(Status.OK_200));
89+
}
7890
}

0 commit comments

Comments
 (0)