I am trying to upload a Softwarefile from Jenkins to a server via Pipeline. The Server API needs the following information:
Content-Type: multipart/form-data;
boundary= 'boundary'
body =
--'boundary'
Content-Disposition: form-data; name=file; filename=origFilename
????
--'boundary'--
Unfortunately the HTTP Request Plugin does not support Content-Type "multipart/form-data" (https://www.jenkins.io/doc/pipeline/steps/http_request/)
I tried to just leave out the content type (since I have the options to leave it out or giving a false one) and got 415 error code. Since I'm trying to send a .txt file and knowing that the server accepts text-files (I successfully uploaded one via Postman) I think this may results from the content-type.
Current Code:
httpRequest httpMode: 'POST', url: "https:<host>.com/", requestBody: '--' + "<boundary>" + 'Content-Disposition: form-data; name="file";' + 'filename="JenkinsDemo.txt"' + '???' + "<boundary>" + '--'
Is there any other way to get the file uploaded to the server? Or do you have a solution for using the plugin?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…