I have a request where I save one field using pm.environment.set('key', value);
My next request is a Post Call where I send value as a text in body but when I pass body as {{value}} and set Postman dropdown to text, my request fails with error code 400.
I wonder if there is a way to send body as a text in chaining.
Your question may already have an answer on the community forum. Please search for related topics, and then read through the guidelines before creating a new topic.
@jonsworkalias Yes, I did.
The API call goes through when Body is passed as text directly.
When I do chaining I noticed Postman don’t read {{body}} when passed as text during chaining. I have attached screenshots for reference.
You have 2 different Content-Type Headers set for the 2 requests.
The one that fails has text/plain and the one that goes through have application/x-www-form-urlencoded
Which one is it supposed to be?
Also, if you open/expand the request from the Postman Console, you will see what has been sent rather than using the code feature which would generate a snippet of code to be sent.
@danny-dainton You were right. I was using text/plain header which is wrong. However, using the correct header too application/x-www-form-urlencoded didn’t fix the issue. Although, I am getting response but it is not what is supposed to be.
Basically, I am querying Solr. The request will go through without body too but the response will not have what I needed.