I can see the response on the output, that’s fine.
Then i have a FOR with that list:
and flows make a Request (POST) per item, to include some variables from the list:
And then i have the 400 error.
When i see the logs on the console, i realize that the content variable is being cutted off by Postman. Does it matter if it’s a HTML variable? i really don’t think that’s the issue.
This is the problem (based on the console log of the request):
<a href="https:
Then, the new line is the next variable, so there is no double quote to end the content parameter. Then, there is an error on my JSON.
Also, if you check the request, there is no error on it
Thank you so much for the very clean and detailed description of the issue you’re encountering. I wish others were as detailed as this as well
At first glance, I’m thinking that character escaping may be the issue at hand here. The double quotes would normally need to be properly escaped and when we throw in the slashes, it ends up being cut off like that.
A few other possible issues could be:
Payload Size: Check if the size of the POST payload is within the acceptable limits for both Postman and the API endpoint you’re hitting.
Headers and Content-Type: Ensure that the headers, especially the Content-Type, are set correctly for the POST request. If the content is being sent as JSON, make sure the header is application/json.
Some potential workarounds could include:
Use Postman’s built-in functions to stringify the JSON object, which will automatically handle the character escaping. For example:
let contentData = {
content: "<a href=\"https://example.com\">Link</a>"
};
pm.request.body.update(JSON.stringify(contentData));
Try breaking the content variable into smaller chunks and ensure that each chunk is sent correctly. This can help narrow down the specific point or character that might be causing the issue.
Use a tool like Base64 to encode the content string and then decode it on the server-side. This can help bypass any issues related to special characters.
Doing more research i could found there are some new lines on the string.
And, not sure why, but Postman is just sending the first row.
I use to use a function on Postman request > Test like this:
data = data.replace(/(\r\n|\n|\r)/gm, "");
What’s the way to remove new lines and then use the variable in another method?
There’s a few ways you can do this that I can think of right now.
The evaluate block in Flows would allow you to sanitize the string before it’s passed to the POST request. Something like your regex should work fine there and Postbot can help you with writing the FQL if you get stuck
Another would be to write the test script manually outside of flows on the request itself, and storing it as an environment variable to use in your Flow.
i can make it works, using $trim(variable).
My current problem is sending JSON data, with string values, Postman is cutting with double quotes like here:
where there is a:
"content":"<div <p class="mb-2">....
As you can see with colors, there is a black and then red color, so postman is cutting the content.
I am trying to fixing this, but i guess this should be an internal bug, because if you see this flow: