ottobackwards commented on a change in pull request #4234:
URL: https://github.com/apache/nifi/pull/4234#discussion_r416030191
##########
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:
I am sorry, I thought I had changed that, let me fix it
----------------------------------------------------------------
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:
[email protected]