POST URL changing when being sent

Hi Postman Community. I haven’t been using postman for very long and I’m encountering an issue I’m hoping someone has seen before. I didn’t find anything as a bug so I’m guessing I’m just doing something wrong.

I’m trying to POST to the following URL that has 3 variables.

https://{{IPaddress}}:5000/post/build/{{BuildNumber}}/workflow/{{WorkflowID}}

When I do this it POSTs to

https://10.193.75.133:5000/workflow/64

and cuts out the post/build/{{BuildNumber}} section. If I change the URL to remove the variable like below it works fine.

https://{{IPaddress}}:5000/post/build/941/workflow/{{WorkflowID}}

the BuildNumber variable is an environment variable which does get changed after the first POST in the collection sets it, however all the other POSTs before the failing one are

https://{{IPaddress}}:5000/build/step/{{BuildNumber}}

and work fine.

The other variables are
IPaddress - set in the environment
WorkflowID - set in a CSV thats used when running the collection

Could this be due to having 3 variables? All the other URLs have only 2 and removing the 3rd it works fine. I’ve seen examples with more so that doesn’t seem like the issue though.

Thanks for any help!

After some testing I found the issue. The value it’s filling in has a new line character after it. I assume this doesn’t affect the other URLs because the BuildNumber variable is at the end of the URL. So I have a new question.

Currently I’m using this test to set the variable value from the response in the first POST

pm.test(“Build Number Set”, function () {
var ResponseNumber = pm.response.text();
pm.environment.set(“BuildNumber”,ResponseNumber);
});

The response from the POST is just the digits of the build number and nothing else. Is there a better way to set this that doesn’t grab the additional character?

Thanks!
Kadall

Changing from text to json eliminated the extra character

pm.test(“Build Number Set”, function () {
var ResponseNumber = pm.response.json();
pm.environment.set(“BuildNumber”,ResponseNumber);
});