Only non-null input resets scheme specific part
Closes gh-24444
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -769,6 +769,21 @@ public class UriComponentsBuilderTests {
|
||||
assertThat(uriComponents.getQueryParams().get("bar").get(0)).isNull();
|
||||
}
|
||||
|
||||
@Test // gh-24444
|
||||
public void opaqueUriDoesNotResetOnNullInput() throws URISyntaxException {
|
||||
URI uri = new URI("urn:ietf:wg:oauth:2.0:oob");
|
||||
UriComponents result = UriComponentsBuilder.fromUri(uri)
|
||||
.host(null)
|
||||
.port(-1)
|
||||
.port(null)
|
||||
.queryParams(null)
|
||||
.replaceQuery(null)
|
||||
.query(null)
|
||||
.build();
|
||||
|
||||
assertThat(result.toUri()).isEqualTo(uri);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void relativeUrls() {
|
||||
String baseUrl = "https://example.com";
|
||||
|
||||
Reference in New Issue
Block a user