I need to send a file in jpeg format and a json string in post-request. Screenshots below
By sending this request, I get an incorrect data display and an incorrect type in NiFi (This works even if the application/json or image/jpeg type is explicitly specified). Below you can see the name of the mime.type attribute for two flow files. In theory, application/json and image/jpeg should have been written here.
And the contents of the JSON file are displayed as follows:
Is there any way to make sure that the file type is displayed correctly, and we can see the contents in json file?
As per my experience, the issue you faced could be the content-type(multipart/form-data;boundary...) is not officially supported by content-viewer page's engine. It does support Content-Type (such as application/json, application/xml, text/plain etc.) in original/formatted mode. Other types can be viewed via hex mode.
Directly supported Type under original mode:
1. application/json 2. application/xml 3. text/plain Note: you may also append the charset encoding to the specified content-type. e.g. application/json;charset=utf-8
WORKAROUND 1. You can try to put an UpdateAttribute Processor (Configure it with an attribute "mime.type" along with the supported Content-Type listed above, specifying this attribute would not change the actual content, it just tells the content-viewer to depend on such way to parse and display the flowfile's content. ) 2. View the flowfile's content via Hex mode.
Hope this helps, and feel free to contact me if you have any questions. Thanks