16
16
*
17
17
*/
18
18
19
- package test .org .springdoc .ui .app32 ;
19
+ package test .org .springdoc .ui .app33 ;
20
20
21
21
import jakarta .annotation .PostConstruct ;
22
22
import org .junit .jupiter .api .Test ;
37
37
38
38
39
39
@ SpringBootTest (webEnvironment = WebEnvironment .DEFINED_PORT ,
40
- properties = { // "spring.webflux.base-path=/test",
41
- "server.forward-headers-strategy=native " ,
40
+ properties = { "spring.webflux.base-path=/test" ,
41
+ "server.forward-headers-strategy=framework " ,
42
42
"server.port=9318" ,
43
43
"springdoc.swagger-ui.path=/documentation/swagger-ui.html" ,
44
44
"springdoc.api-docs.path=/documentation/v3/api-docs" ,
47
47
@ Import (SpringDocConfig .class )
48
48
public class SpringDocBehindProxyBasePathTest extends AbstractCommonTest {
49
49
50
- private static final String X_FORWARD_PREFIX = "/path/prefix" ;
50
+ public static final String WEBFLUX_BASE_PATH = "/test" ;
51
+ public static final String X_FORWARD_PREFIX = "/path/prefix" ;
51
52
52
53
@ LocalServerPort
53
54
private int port ;
@@ -62,21 +63,22 @@ void init() {
62
63
63
64
@ Test
64
65
public void testIndex () throws Exception {
65
- HttpStatusCode httpStatusMono = webClient .get ().uri ("/documentation/swagger-ui.html" )
66
+ HttpStatusCode httpStatusMono = webClient .get ().uri (WEBFLUX_BASE_PATH + "/documentation/swagger-ui.html" )
66
67
.header ("X-Forwarded-Prefix" , X_FORWARD_PREFIX )
67
68
.exchangeToMono (clientResponse -> Mono .just (clientResponse .statusCode ())).block ();
68
69
assertThat (httpStatusMono ).isEqualTo (HttpStatus .FOUND );
69
70
70
- httpStatusMono = webClient .get ().uri ("/documentation/webjars-pref/swagger-ui/index.html" )
71
+ httpStatusMono = webClient .get ().uri (WEBFLUX_BASE_PATH + "/documentation/webjars-pref/swagger-ui/index.html" )
71
72
.header ("X-Forwarded-Prefix" , X_FORWARD_PREFIX )
72
73
.exchangeToMono (clientResponse -> Mono .just (clientResponse .statusCode ())).block ();
73
74
assertThat (httpStatusMono ).isEqualTo (HttpStatus .OK );
74
75
75
- String contentAsString = webClient .get ().uri ("/documentation/v3/api-docs/swagger-config" )
76
+ String contentAsString = webClient .get ().uri (WEBFLUX_BASE_PATH + "/documentation/v3/api-docs/swagger-config" )
76
77
.header ("X-Forwarded-Prefix" , X_FORWARD_PREFIX )
77
78
.retrieve ()
78
79
.bodyToMono (String .class ).block ();
79
- String expected = getContent ("results/app32-1.json" );
80
+
81
+ String expected = getContent ("results/app33.json" );
80
82
assertEquals (expected , contentAsString , true );
81
83
}
82
84
0 commit comments