markap14 commented on a change in pull request #4234:
URL: https://github.com/apache/nifi/pull/4234#discussion_r416029131



##########
File path: 
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/InvokeHTTP.java
##########
@@ -1039,10 +1084,39 @@ public void writeTo(BufferedSink sink) throws 
IOException {
                 }
 
                 @Override
-                public long contentLength(){
+                public long contentLength() {
                     return useChunked ? -1 : requestFlowFile.getSize();
                 }
             };
+
+            if (propertyDescriptors.size() > 0) {
+                // we have form data
+                MultipartBody.Builder builder = new 
Builder().setType(MultipartBody.FORM);
+                String contentKey = null;
+                String contentFileName = null;
+
+                // loop through the dynamic form parameters
+                // we can't add the content before we know if there is a file 
name or not, so we
+                // get the keys and do them after this
+                for (final Map.Entry<String, PropertyDescriptor> entry : 
propertyDescriptors.entrySet()) {
+                    final String propValue = 
context.getProperty(entry.getValue().getName()).evaluateAttributeExpressions(requestFlowFile).getValue();
+                    if (propValue.equals(FLOWFILE_CONTENT_FORM_MARKER)) {
+                        contentKey = entry.getKey();
+                    } else if 
(entry.getValue().getName().equals(FLOWFILE_CONTENT_FORM_FILE_NAME)) {
+                        contentFileName = propValue;
+                    } else {
+                        builder.addFormDataPart(entry.getKey(), propValue);
+                    }
+                }
+                if (contentKey != null) {
+                    ByteArrayOutputStream byteArrayOutputStream = new 
ByteArrayOutputStream();

Review comment:
       It appears that this. is buffering the content of the entire FlowFile 
into a ByteArrayOutputStream -- and then doing nothing with it. Was this just 
an artifact of a refactoring and was missed or something?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to