I would like to perform an HTTP POST of a Binary file, as I would from Postman like this:
Note here I have selected HTTP Post, with the binary option, and flagged my file "splop.sar".
The server replies http 409 which is expected for my use case.
My attempt in Jenkins has been as follows, using the httpRequest plugin :
def myFile = readFile("splop.sar")
httpRequest authentication: 'userdef', consoleLogResponseBody: true, contentType: 'APPLICATION_ZIP', httpMode: 'POST', requestBody: myFile, responseHandle: 'NONE', url: 'myurl.com/service'
The problem is, my backend server rejects the request as invalid, no doubt the encoding has failed here. I have tried alternatives such as:
def myFile = readFile("splop.sar").bytes
Which also fails, as well as:
def myFile = readFile("splop.sar").bytes.toString()
Which also fails!
What can I do within Jenkins to provide the same style of HTTP Post that postman is giving from within my pipeline? I believe the big difference here is what makes the POST request a 'binary' post, against some other form?