Skip to content

Commit 153ac82

Browse files
committed
Polish
1 parent 4973e11 commit 153ac82

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

spring-web/src/main/java/org/springframework/web/server/adapter/ForwardedHeaderTransformer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

spring-web/src/test/java/org/springframework/web/server/adapter/ForwardedHeaderTransformerTests.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -90,19 +90,19 @@ public void xForwardedPrefix() throws Exception {
9090
assertForwardedHeadersRemoved(request);
9191
}
9292

93-
@Test
94-
public void emptyXForwardedPrefixShouldNotLeadToDecodedPath() throws Exception {
93+
@Test // gh-23305
94+
public void xForwardedPrefixShouldNotLeadToDecodedPath() throws Exception {
9595
HttpHeaders headers = new HttpHeaders();
96-
headers.add("X-Forwarded-Prefix", "");
96+
headers.add("X-Forwarded-Prefix", "/prefix");
9797
ServerHttpRequest request = MockServerHttpRequest
9898
.method(HttpMethod.GET, new URI("https://example.com/a%20b?q=a%2Bb"))
9999
.headers(headers)
100100
.build();
101101

102102
request = this.requestMutator.apply(request);
103103

104-
assertThat(request.getURI()).isEqualTo(new URI("https://example.com/a%20b?q=a%2Bb"));
105-
assertThat(request.getPath().value()).isEqualTo("/a%20b");
104+
assertEquals(new URI("https://example.com/prefix/a%20b?q=a%2Bb"), request.getURI());
105+
assertEquals("/prefix/a%20b", request.getPath().value());
106106
assertForwardedHeadersRemoved(request);
107107
}
108108

0 commit comments

Comments
 (0)