This is the exact scenario.
I make a GET request that returns a list (you can see on the image, there are 15 elements inside body.data.contents:
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):
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
And on the output, i can see the entire variable in a single line.
So there is no cutting on my side!
Postman for Mac
UI version: 10.19.0-ui-230919-1303
Desktop platform version: 10.19.0
OS platform: OS X 23.0.0
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
Some potential workarounds could include:
Thanks @kevinc-postman for your soon answer.
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:
i get the content variable, i trim it, remove new lines, and then send it as parameter to a new request.
Should Postman Flows escape it on your end?
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.