mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-26 08:59:09 +00:00
Decode target parameters prior to saving a FlashMap
The target parameters for a FlashMap must be decoded to be able to match them to the parameters of incoming requests given that the HttpServletRequest returns decoded request parameters. Issue: SPR-9657 Backport Issue: SPR-9701
This commit is contained in:
+16
@@ -264,6 +264,22 @@ public class AbstractFlashMapManagerTests {
|
||||
assertEquals("/once/only", flashMap.getTargetRequestPath());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void saveOutputFlashMapDecodeParameters() throws Exception {
|
||||
this.request.setCharacterEncoding("UTF-8");
|
||||
|
||||
FlashMap flashMap = new FlashMap();
|
||||
flashMap.put("anyKey", "anyValue");
|
||||
|
||||
flashMap.addTargetRequestParam("key", "%D0%90%D0%90");
|
||||
flashMap.addTargetRequestParam("key", "%D0%91%D0%91");
|
||||
flashMap.addTargetRequestParam("key", "%D0%92%D0%92");
|
||||
this.flashMapManager.saveOutputFlashMap(flashMap, this.request, this.response);
|
||||
|
||||
assertEquals(Arrays.asList("\u0410\u0410", "\u0411\u0411", "\u0412\u0412"),
|
||||
flashMap.getTargetRequestParams().get("key"));
|
||||
}
|
||||
|
||||
|
||||
private static class TestFlashMapManager extends AbstractFlashMapManager {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user