500 error while uploading a file as a request body

Content-Type: application/octet-stream

Response :

{"path":"/upload-file","error":"Internal Server Error","message":"500 : [no body]","timestamp":"2020-09-17T06:11:11.127+0000","status":"500"}

I am not able to find the issue.

Javascript policy is as below :

var ctype = context.getVariable('request.header.content-type');

var re1 = new RegExp('^multipart/form-data; *boundary=(.+)

var match = re1.exec(ctype);

var boundary = match[1];

var blength = boundary.length;

var body = context.getVariable('request.content');

var re2 = new RegExp('^--' + boundary + '

var re3 = new RegExp('^Content-Disposition: form-data; name="(.+)"$[\r\n]+(.+) var section; var payload = {}; while ((section = re2.exec(body)) !== null) { var start = section.index + blength + 1; var blob = body.substring(start, section.lastIndex); match = re3.exec(blob); if (match) { context.setVariable('extracted_' + match[1], match[2]); payload[match[1]] = match[2]; } } ('resp_payload', JSON.stringify(payload, null, 2)););

0 1 481
1 REPLY 1

Not applicable

what operation are you trying to do on the payload?