Hello everyone,
I have a proxy that accepts an uploaded binary(.bin) file as part of "multipart/form-data" request.
When I am calculating the Content-Length value using a Javascript policy, it differs from the value present in the Content-Length header. I am using the below Javascript to calculate the length of the payload.
var requestPayload = context.getVariable("request.content"); var payloadLength = requestPayload.length; print(payloadLength); var contentLengthHeader = context.getVariable("request.header.Content-Length"); print(contentLengthHeader);
Below is the CURL command for proxy:
curl -v "https://xxx-test.apigee.net/path" -F file1=@sample.bin
The CURL gives the below output
Host: xxx-test.apigee.net User-Agent: curl/7.53.1 Accept: */* Content-Length: 835 Expect: 100-continue Content-Type: multipart/form-data; boundary=------------------------319463f6aef4af34
The value present in Content-Length" is 835 whereas, the value calculated by the javascript is 832.
Is there anything I am missing or doing wrong here? Or Is Apigee transforming the payload in some way?
Note: I am not able to attach the sample.bin which I am sending in my CURL command. I have downloaded this file from here
Thanks in advance, Any help is appreciated!
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |