Polishing contribution

Closes gh-30137
This commit is contained in:
rstoyanchev
2023-09-20 18:43:33 +01:00
parent a1c4fb3840
commit cc296c5033
2 changed files with 25 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-202 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.
@@ -57,7 +57,7 @@ class ForwardedHeaderTransformerTests {
}
@Test
void xForwardedHeaders() throws Exception {
void xForwardedHeaders() {
HttpHeaders headers = new HttpHeaders();
headers.add("X-Forwarded-Host", "84.198.58.199");
headers.add("X-Forwarded-Port", "443");
@@ -70,7 +70,7 @@ class ForwardedHeaderTransformerTests {
}
@Test
void forwardedHeader() throws Exception {
void forwardedHeader() {
HttpHeaders headers = new HttpHeaders();
headers.add("Forwarded", "host=84.198.58.199;proto=https");
ServerHttpRequest request = this.requestMutator.apply(getRequest(headers));
@@ -80,7 +80,7 @@ class ForwardedHeaderTransformerTests {
}
@Test
void xForwardedPrefix() throws Exception {
void xForwardedPrefix() {
HttpHeaders headers = new HttpHeaders();
headers.add("X-Forwarded-Prefix", "/prefix");
ServerHttpRequest request = this.requestMutator.apply(getRequest(headers));
@@ -91,7 +91,7 @@ class ForwardedHeaderTransformerTests {
}
@Test // gh-23305
void xForwardedPrefixShouldNotLeadToDecodedPath() throws Exception {
void xForwardedPrefixShouldNotLeadToDecodedPath() {
HttpHeaders headers = new HttpHeaders();
headers.add("X-Forwarded-Prefix", "/prefix");
ServerHttpRequest request = MockServerHttpRequest
@@ -107,7 +107,7 @@ class ForwardedHeaderTransformerTests {
}
@Test
void xForwardedPrefixTrailingSlash() throws Exception {
void xForwardedPrefixTrailingSlash() {
HttpHeaders headers = new HttpHeaders();
headers.add("X-Forwarded-Prefix", "/prefix////");
ServerHttpRequest request = this.requestMutator.apply(getRequest(headers));
@@ -118,7 +118,7 @@ class ForwardedHeaderTransformerTests {
}
@Test // SPR-17525
void shouldNotDoubleEncode() throws Exception {
void shouldNotDoubleEncode() {
HttpHeaders headers = new HttpHeaders();
headers.add("Forwarded", "host=84.198.58.199;proto=https");
@@ -133,8 +133,8 @@ class ForwardedHeaderTransformerTests {
assertForwardedHeadersRemoved(request);
}
@Test
void shouldHandleUnencodedUri() throws Exception {
@Test // gh-30137
void shouldHandleUnencodedUri() {
HttpHeaders headers = new HttpHeaders();
headers.add("Forwarded", "host=84.198.58.199;proto=https");
ServerHttpRequest request = MockServerHttpRequest
@@ -149,7 +149,7 @@ class ForwardedHeaderTransformerTests {
}
@Test
void shouldConcatenatePrefixes() throws Exception {
void shouldConcatenatePrefixes() {
HttpHeaders headers = new HttpHeaders();
headers.add("X-Forwarded-Prefix", "/first,/second");
ServerHttpRequest request = this.requestMutator.apply(getRequest(headers));
@@ -160,7 +160,7 @@ class ForwardedHeaderTransformerTests {
}
@Test
void shouldConcatenatePrefixesWithTrailingSlashes() throws Exception {
void shouldConcatenatePrefixesWithTrailingSlashes() {
HttpHeaders headers = new HttpHeaders();
headers.add("X-Forwarded-Prefix", "/first/,/second//");
ServerHttpRequest request = this.requestMutator.apply(getRequest(headers));