@@ -253,34 +253,34 @@ private void writeFormParam(MethodParam param, ParamType paramType) {
253253
254254 private void writeBody () {
255255 for (MethodParam param : method .params ()) {
256- ParamType paramType = param .paramType ();
257-
258- if (paramType == ParamType .BODY ) {
259-
256+ if (param .paramType () == ParamType .BODY ) {
260257 var type = param .utype ().full ();
261- if ("java.net.http.HttpRequest.BodyPublisher" .equals (type )
262- || "java.lang.String" .equals (type )
263- || "byte[]" .equals (type )
264- || "java.io.InputStream" .equals (type )
265- || "java.util.function.Supplier<?extendsjava.io.InputStream>" .equals (type )
266- || "java.util.function.Supplier<java.io.InputStream>" .equals (type )
267- || "java.nio.file.Path" .equals (type )
268- || "io.avaje.http.client.BodyContent" .equals (type )) {
269-
258+ if (directBodyType (type )) {
270259 writer .append (" .body(%s)" , param .name ()).eol ();
271-
272260 } else {
273-
274261 writer .append (" .body(%s, " , param .name ());
275262 writeGeneric (param .utype ());
276263 writer .append (")" ).eol ();
277264 }
278-
279265 return ;
280266 }
281267 }
282268 }
283269
270+ /**
271+ * Return true for body types that are directly supported.
272+ */
273+ private static boolean directBodyType (String type ) {
274+ return "java.net.http.HttpRequest.BodyPublisher" .equals (type )
275+ || "java.lang.String" .equals (type )
276+ || "byte[]" .equals (type )
277+ || "java.io.InputStream" .equals (type )
278+ || "java.util.function.Supplier<?extendsjava.io.InputStream>" .equals (type )
279+ || "java.util.function.Supplier<java.io.InputStream>" .equals (type )
280+ || "java.nio.file.Path" .equals (type )
281+ || "io.avaje.http.client.BodyContent" .equals (type );
282+ }
283+
284284 private void writePaths (Set <PathSegments .Segment > segments ) {
285285 if (!segments .isEmpty ()) {
286286 writer .append (" " );
0 commit comments