File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed
spring-web/src/test/java/org/springframework/web/util Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2018 the original author or authors.
2
+ * Copyright 2002-2019 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
25
25
26
26
import org .junit .Test ;
27
27
28
+ import org .springframework .http .HttpHeaders ;
28
29
import org .springframework .http .HttpRequest ;
29
30
import org .springframework .http .server .ServletServerHttpRequest ;
30
31
import org .springframework .mock .web .test .MockHttpServletRequest ;
@@ -518,6 +519,29 @@ public void fromHttpRequestWithTrailingSlash() {
518
519
assertEquals ("/foo/" , after .getPath ());
519
520
}
520
521
522
+ @ Test // gh-19890
523
+ public void fromHttpRequestWithEmptyScheme () {
524
+ HttpRequest request = new HttpRequest () {
525
+ @ Override
526
+ public String getMethodValue () {
527
+ return "GET" ;
528
+ }
529
+
530
+ @ Override
531
+ public URI getURI () {
532
+ return UriComponentsBuilder .fromUriString ("/" ).build ().toUri ();
533
+ }
534
+
535
+ @ Override
536
+ public HttpHeaders getHeaders () {
537
+ return new HttpHeaders ();
538
+ }
539
+ };
540
+ UriComponents result = UriComponentsBuilder .fromHttpRequest (request ).build ();
541
+
542
+ assertEquals ("/" , result .toString ());
543
+ }
544
+
521
545
@ Test
522
546
public void path () {
523
547
UriComponentsBuilder builder = UriComponentsBuilder .fromPath ("/foo/bar" );
You can’t perform that action at this time.
0 commit comments