Lenient URI template encoding
URI template encoding ignores mismatched curly braces, treating them as literal parts instead. Issue: SPR-17630
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 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.
|
||||
@@ -27,12 +27,9 @@ import java.util.Collections;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.instanceOf;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.springframework.web.util.UriComponentsBuilder.fromUriString;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.springframework.web.util.UriComponentsBuilder.*;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link UriComponents}.
|
||||
@@ -127,6 +124,12 @@ public class UriComponentsTests {
|
||||
assertEquals("/myurl/test/show", uriComponents.getPath());
|
||||
}
|
||||
|
||||
@Test // SPR-17630
|
||||
public void uirTemplateExpandWithMismatchedCurlyBraces() {
|
||||
assertEquals("/myurl/?q=%7B%7B%7B%7B",
|
||||
UriComponentsBuilder.fromUriString("/myurl/?q={{{{").encode().build().toUriString());
|
||||
}
|
||||
|
||||
@Test // SPR-12123
|
||||
public void port() {
|
||||
UriComponents uri1 = fromUriString("http://example.com:8080/bar").build();
|
||||
|
||||
Reference in New Issue
Block a user