|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2019 the original author or authors. |
| 2 | + * Copyright 2002-2021 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.
|
|
37 | 37 | import org.springframework.core.io.buffer.DataBuffer;
|
38 | 38 | import org.springframework.core.io.buffer.DataBufferUtils;
|
39 | 39 | import org.springframework.http.HttpMethod;
|
| 40 | +import org.springframework.http.HttpStatus; |
40 | 41 | import org.springframework.http.MediaType;
|
41 | 42 | import org.springframework.http.codec.HttpMessageReader;
|
42 | 43 | import org.springframework.http.server.reactive.ServerHttpRequest;
|
|
49 | 50 | import org.springframework.web.bind.support.WebExchangeDataBinder;
|
50 | 51 | import org.springframework.web.reactive.BindingContext;
|
51 | 52 | import org.springframework.web.reactive.result.method.HandlerMethodArgumentResolverSupport;
|
| 53 | +import org.springframework.web.server.ResponseStatusException; |
52 | 54 | import org.springframework.web.server.ServerWebExchange;
|
53 | 55 | import org.springframework.web.server.ServerWebInputException;
|
54 | 56 | import org.springframework.web.server.UnsupportedMediaTypeStatusException;
|
@@ -155,8 +157,10 @@ protected Mono<Object> readBody(MethodParameter bodyParam, @Nullable MethodParam
|
155 | 157 | Object[] hints = extractValidationHints(bodyParam);
|
156 | 158 |
|
157 | 159 | if (mediaType.isCompatibleWith(MediaType.APPLICATION_FORM_URLENCODED)) {
|
158 |
| - return Mono.error(new IllegalStateException( |
159 |
| - "In a WebFlux application, form data is accessed via ServerWebExchange.getFormData().")); |
| 160 | + if (logger.isDebugEnabled()) { |
| 161 | + logger.debug("Form data is accessed via ServerWebExchange.getFormData() in WebFlux."); |
| 162 | + } |
| 163 | + return Mono.error(new ResponseStatusException(HttpStatus.UNSUPPORTED_MEDIA_TYPE)); |
160 | 164 | }
|
161 | 165 |
|
162 | 166 | if (logger.isDebugEnabled()) {
|
|
0 commit comments