Is there a way to automatically calculate and add Content-Length
to an HTTP request’s header, similar to Postman and RapidAPI?
I’m using Make.com to pass order data to a vendor’s API endpoint using the Make a Request module. However, if I don’t include the Content-Length
header in the request, the endpoint times out.
I’m debugging this with the vendor, but I’m not sure if I’m missing something in the scenario’s flow.
I’d appreciate any help or guidance on how to resolve this issue.
Scenario
- Request token: grabs bearer token required to POST data
- HTTP: using bearer token, POST JSON content to endpoint
Errors
If I exclude Content-Length
in the header, I get a generic error of “token is invalid”, even though the token is valid. (Confirmed this is a generic error with the vendor.)
If I include Content-Length
, with the correct byte size value, I get no error message and the data posts. Works well in testing, but not when if I need to calculate the correct value automatically.
{
"error": "invalid_token",
"error_description": "Invalid token: access token is invalid"
}
Testing
I can successfully post using Postman or RapidAPI, and the only differentiating factor I uncovered is Content-Length
being present or not.
Examples
Postman:
Content-Type: application/json
Authorization: Bearer {{TOKEN}}
Cache-Control: no-cache
Postman-Token: {{POSTMAN TOKEN}}
Host: {{DOMAIN}}
Content-Length: 1253
Make:
"Content-Type": "application/json",
"Authorization": "Bearer {{TOKEN}}",
"Cache-Control": "no-cache",
"Host": "dsgproxy.dsgraphics.com",
"User-Agent": "Make/production"