Source:
private HttpRequest configRequest(HttpRequest request, SwaggerMethodParser methodParser, Object[] args) throws IOException { final Object bodyContentObject = methodParser.body(args); if (bodyContentObject == null) { request.headers().put("Content-Length", "0"); } else { String contentType = methodParser.bodyContentType(); if (contentType == null || contentType.isEmpty()) { if (bodyContentObject instanceof byte[] || bodyContentObject instanceof String) { contentType = ContentType.APPLICATION_OCTET_STREAM; } else { contentType = ContentType.APPLICATION_JSON; } } request.headers().put("Content-Type", contentType); boolean isJson = false; final String[] contentTypeParts = contentType.split(";"); for (String contentTypePart : contentTypeParts) { if (contentTypePart.trim().equalsIgnoreCase(ContentType.APPLICATION_JSON)) { isJson = true; break; } } if (isJson) { final String bodyContentString = serializer.serialize(bodyContentObject, SerializerEncoding.JSON); request.body(bodyContentString); } else if (FluxUtil.isFluxByteBuffer(methodParser.bodyJavaType())) { request.body((Flux<ByteBuffer>) bodyContentObject); } else if (bodyContentObject instanceof byte[]) { request.body((byte[]) bodyContentObject); } else if (bodyContentObject instanceof String) { final String bodyContentString = (String) bodyContentObject; if (!bodyContentString.isEmpty()) { request.body(bodyContentString); } } else if(bodyContentObject instanceof ByteBuffer) { request.body(Flux.just(((ByteBuffer) bodyContentObject))); } else { final String bodyContentString = serializer.serialize(bodyContentObject, SerializerEncoding.fromHeaders(request.headers())); request.body(bodyContentString); } } return request; }

Target:
private HttpRequest configRequest(HttpRequest request, SwaggerMethodParser methodParser, Object[] args) throws IOException { final Object bodyContentObject = methodParser.body(args); if (bodyContentObject == null) { request.headers().put("Content-Length", "0"); } else { String contentType = methodParser.bodyContentType(); if (contentType == null || contentType.isEmpty()) { if (bodyContentObject instanceof byte[] || bodyContentObject instanceof String) { contentType = ContentType.APPLICATION_OCTET_STREAM; } else { contentType = ContentType.APPLICATION_JSON; } } request.headers().put("Content-Type", contentType); boolean isJson = false; final String[] contentTypeParts = contentType.split(";"); for (String contentTypePart : contentTypeParts) { if (contentTypePart.trim().equalsIgnoreCase(ContentType.APPLICATION_JSON)) { isJson = true; break; } } if (isJson) { final String bodyContentString = serializer.serialize(bodyContentObject, SerializerEncoding.JSON); request.body(bodyContentString); } else if (FluxUtil.isFluxByteBuffer(methodParser.bodyJavaType())) { request.body((Flux<ByteBuffer>) bodyContentObject); } else if (bodyContentObject instanceof byte[]) { request.body((byte[]) bodyContentObject); } else if (bodyContentObject instanceof String) { final String bodyContentString = (String) bodyContentObject; if (!bodyContentString.isEmpty()) { request.body(bodyContentString); } } else if (bodyContentObject instanceof ByteBuffer) { request.body(Flux.just((ByteBuffer) bodyContentObject)); } else { final String bodyContentString = serializer.serialize(bodyContentObject, SerializerEncoding.fromHeaders(request.headers())); request.body(bodyContentString); } } return request; }