|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2024 the original author or authors. |
| 2 | + * Copyright 2002-2025 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
18 | 18 |
|
19 | 19 | import org.junit.jupiter.api.Test;
|
20 | 20 |
|
| 21 | +import org.springframework.http.HttpHeaders; |
| 22 | +import org.springframework.http.MediaType; |
21 | 23 | import org.springframework.http.codec.ServerCodecConfigurer;
|
| 24 | +import org.springframework.util.MultiValueMap; |
22 | 25 | import org.springframework.web.server.ServerWebExchange;
|
23 | 26 | import org.springframework.web.server.i18n.AcceptHeaderLocaleContextResolver;
|
24 | 27 | import org.springframework.web.server.session.DefaultWebSessionManager;
|
@@ -56,6 +59,17 @@ void transformUrlWithMultipleEncoders() {
|
56 | 59 | assertThat(exchange.transformUrl("/foo")).isEqualTo("/foo;p=abc?q=123");
|
57 | 60 | }
|
58 | 61 |
|
| 62 | + @Test // gh-34660 |
| 63 | + void useFormDataMessageReaderWhenAllContentType() { |
| 64 | + MockServerHttpRequest request = MockServerHttpRequest |
| 65 | + .post("https://example.com") |
| 66 | + .header(HttpHeaders.CONTENT_TYPE, MediaType.ALL_VALUE) |
| 67 | + .body("project=spring"); |
| 68 | + ServerWebExchange exchange = createExchange(request); |
| 69 | + MultiValueMap<String, String> body = exchange.getFormData().block(); |
| 70 | + assertThat(body.get("project")).contains("spring"); |
| 71 | + } |
| 72 | + |
59 | 73 |
|
60 | 74 | private DefaultServerWebExchange createExchange() {
|
61 | 75 | MockServerHttpRequest request = MockServerHttpRequest.get("https://example.com").build();
|
|
0 commit comments