I'm trying to reproduce a `multipart/form-data` request within Jira Automation. The request is a POST to the Confluence v1 API attachments endpoint, and I have called this successfully using Postman.
However, when running within Jira Automation, I'm receiving code 500: `java.lang.RuntimeException: org.apache.commons.fileupload.FileUploadException: Stream ended unexpectedly`.
Researching this error has sent me round in circles with variations of CRLF (or ``), and I have tried every permutation to no avail. This post looked particularly promising, pointing specifically to the new line before the last boundary - again I experimented to no avail.
The below is the exact request Postman is making for a very simple text file, as captured by Fiddler. I have lifted this exact text into the Jira Automation web request, configuring the same headers Postman is using.
----------------------------882762106784743758392779
Content-Disposition: form-data; name="file"; filename="New Text Document.txt"
Content-Type: text/plain
SampleTextContent
----------------------------882762106784743758392779
Content-Disposition: form-data; name="minorEdit"
1
----------------------------882762106784743758392779--
`Content-Type` header configured in Jira Automation is:
multipart/form-data; boundary=--------------------------882762106784743758392779
Where am I going wrong? TIA!
*Side note - I'm doing this because I want to automatically create a Confluence page which carries the same attachments as the Jira issue that triggered it. If anyone is aware of another way to do this, I'd welcome ideas.