File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
main/java/org/springframework/web/util
test/java/org/springframework/web/util Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change 29
29
* Parser for URI's based on RFC 3986 syntax.
30
30
*
31
31
* @author Rossen Stoyanchev
32
+ * @author Yanming Zhou
32
33
* @since 6.2
33
34
*
34
35
* @see <a href="https://www.rfc-editor.org/info/rfc3986">RFC 3986</a>
@@ -510,7 +511,7 @@ public InternalParser resolveIfOpaque() {
510
511
511
512
public InternalParser captureScheme () {
512
513
String scheme = captureComponent ("scheme" );
513
- this .scheme = (!scheme .startsWith ("{" ) ? scheme .toLowerCase (Locale .ROOT ) : scheme );
514
+ this .scheme = (!scheme .contains ("{" ) ? scheme .toLowerCase (Locale .ROOT ) : scheme );
514
515
return this ;
515
516
}
516
517
Original file line number Diff line number Diff line change 47
47
* @author Juergen Hoeller
48
48
* @author Sam Brannen
49
49
* @author David Eckel
50
+ * @author Yanming Zhou
50
51
*/
51
52
class UriComponentsBuilderTests {
52
53
@@ -637,6 +638,24 @@ void schemeVariableMixedCase(ParserType parserType) {
637
638
.buildAndExpand (Map .of ("TheScheme" , "ws" ))
638
639
.toUri ();
639
640
assertThat (uri .toString ()).isEqualTo ("ws://example.org" );
641
+
642
+ uri = UriComponentsBuilder
643
+ .fromUriString ("{TheScheme}s://example.org" , parserType )
644
+ .buildAndExpand (Map .of ("TheScheme" , "ws" ))
645
+ .toUri ();
646
+ assertThat (uri .toString ()).isEqualTo ("wss://example.org" );
647
+
648
+ uri = UriComponentsBuilder
649
+ .fromUriString ("s{TheScheme}://example.org" , parserType )
650
+ .buildAndExpand (Map .of ("TheScheme" , "ws" ))
651
+ .toUri ();
652
+ assertThat (uri .toString ()).isEqualTo ("sws://example.org" );
653
+
654
+ uri = UriComponentsBuilder
655
+ .fromUriString ("s{TheScheme}s://example.org" , parserType )
656
+ .buildAndExpand (Map .of ("TheScheme" , "ws" ))
657
+ .toUri ();
658
+ assertThat (uri .toString ()).isEqualTo ("swss://example.org" );
640
659
}
641
660
642
661
@ ParameterizedTest
You can’t perform that action at this time.
0 commit comments