|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2024 the original author or authors. |
|
|
|
* Copyright 2002-2025 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -18,7 +18,10 @@ package org.springframework.web.server.adapter; |
|
|
|
|
|
|
|
|
|
|
|
import org.junit.jupiter.api.Test; |
|
|
|
import org.junit.jupiter.api.Test; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.http.HttpHeaders; |
|
|
|
|
|
|
|
import org.springframework.http.MediaType; |
|
|
|
import org.springframework.http.codec.ServerCodecConfigurer; |
|
|
|
import org.springframework.http.codec.ServerCodecConfigurer; |
|
|
|
|
|
|
|
import org.springframework.util.MultiValueMap; |
|
|
|
import org.springframework.web.server.ServerWebExchange; |
|
|
|
import org.springframework.web.server.ServerWebExchange; |
|
|
|
import org.springframework.web.server.i18n.AcceptHeaderLocaleContextResolver; |
|
|
|
import org.springframework.web.server.i18n.AcceptHeaderLocaleContextResolver; |
|
|
|
import org.springframework.web.server.session.DefaultWebSessionManager; |
|
|
|
import org.springframework.web.server.session.DefaultWebSessionManager; |
|
|
|
@ -56,6 +59,17 @@ class DefaultServerWebExchangeTests { |
|
|
|
assertThat(exchange.transformUrl("/foo")).isEqualTo("/foo;p=abc?q=123"); |
|
|
|
assertThat(exchange.transformUrl("/foo")).isEqualTo("/foo;p=abc?q=123"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test // gh-34660
|
|
|
|
|
|
|
|
void useFormDataMessageReaderWhenAllContentType() { |
|
|
|
|
|
|
|
MockServerHttpRequest request = MockServerHttpRequest |
|
|
|
|
|
|
|
.post("https://example.com") |
|
|
|
|
|
|
|
.header(HttpHeaders.CONTENT_TYPE, MediaType.ALL_VALUE) |
|
|
|
|
|
|
|
.body("project=spring"); |
|
|
|
|
|
|
|
ServerWebExchange exchange = createExchange(request); |
|
|
|
|
|
|
|
MultiValueMap<String, String> body = exchange.getFormData().block(); |
|
|
|
|
|
|
|
assertThat(body.get("project")).contains("spring"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private DefaultServerWebExchange createExchange() { |
|
|
|
private DefaultServerWebExchange createExchange() { |
|
|
|
MockServerHttpRequest request = MockServerHttpRequest.get("https://example.com").build(); |
|
|
|
MockServerHttpRequest request = MockServerHttpRequest.get("https://example.com").build(); |
|
|
|
|