Skip to content

Commit

Permalink
Merge pull request quarkusio#37219 from geoand/quarkusio#36943
Browse files Browse the repository at this point in the history
Warn when the HTTP method is not supposed to have a body
  • Loading branch information
gsmet authored Dec 4, 2023
2 parents 70cdf67 + 136460c commit 19ef467
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import static org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames.ENCODED;
import static org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames.FLOAT;
import static org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames.FORM_PARAM;
import static org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames.GET;
import static org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames.HEAD;
import static org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames.HEADER_PARAM;
import static org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames.HTTP_HEADERS;
import static org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames.INSTANT;
Expand All @@ -37,6 +39,7 @@
import static org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames.OFFSET_DATE_TIME;
import static org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames.OFFSET_TIME;
import static org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames.OPTIONAL;
import static org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames.OPTIONS;
import static org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames.PATH;
import static org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames.PATH_PARAM;
import static org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames.PATH_SEGMENT;
Expand Down Expand Up @@ -626,6 +629,10 @@ private ResourceMethod createResourceMethod(ClassInfo currentClassInfo, ClassInf
"Resource method " + currentMethodInfo + " can only have a single body parameter: "
+ currentMethodInfo.parameterName(i));
bodyParamType = paramType;
if (GET.equals(httpMethod) || HEAD.equals(httpMethod) || OPTIONS.equals(httpMethod)) {
log.warn("Using a body parameter with " + httpMethod + " is strongly discouraged. Offending method is '"
+ currentMethodInfo.declaringClass().name() + "#" + currentMethodInfo + "'");
}
}
String elementType = parameterResult.getElementType();
boolean single = parameterResult.isSingle();
Expand Down

0 comments on commit 19ef467

Please sign in to comment.