Raise ISE if @RequestBody is used for form data

Closes gh-22486
This commit is contained in:
Rossen Stoyanchev 2019-03-20 20:27:53 -04:00
parent b67039d19a
commit e9819b7535
1 changed files with 6 additions and 1 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2019 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.
@ -153,6 +153,11 @@ public abstract class AbstractMessageReaderArgumentResolver extends HandlerMetho
MediaType mediaType = (contentType != null ? contentType : MediaType.APPLICATION_OCTET_STREAM);
Object[] hints = extractValidationHints(bodyParam);
if (mediaType.isCompatibleWith(MediaType.APPLICATION_FORM_URLENCODED)) {
return Mono.error(new IllegalStateException(
"In a WebFlux application, form data is accessed via ServerWebExchange.getFormData()."));
}
if (logger.isDebugEnabled()) {
logger.debug(exchange.getLogPrefix() + (contentType != null ?
"Content-Type:" + contentType :