Hello everyone,
I can’t wrap my head around the behavior of my pm.request.url variable.
I want to send a POST request twice to the same url, that is why in my test script I send a request via sendRequest() to the url stored in pm.request.url.
When I print out pm.request.url, it shows me exactly what I expect: A url without any additional query parameters.
However, when I send the request, my postman console shows the url with some extra query parameters:
http://…?members&reference&Type&_postman_listIndexKey=key&
_postman_listAllowsMultipleValues
As far as I understood, the pm.request.url is an url object that, besides the host and path can have a list of query parameters, which I can get with the getPathWithQuery() or the getQueryString(options opt, nullable) function, both of which shall return a string. However, when I print the result of getPathWithQuery(), I get nothing but the path without the additional query parameters. The printed getQueryString() method does not even provide me anything which makes sense to me:
function(t){return this.query.count()?typeof t===OBJECT?QueryParam.unparse(this.query.all(),t):QueryParam.unparse(this.query.all(),{encode:t}):E}
When are those query parameters added to my uri and why?
Here the method I am using for sending the request:
pm.sendRequest({
url: pm.request.url,
method: 'POST',
header: {
'content-type': 'application/json',
'accept': '*/*',
'connection': 'keep-alive'
},
body: {
mode: 'raw',
raw: bodyRaw
}}, function (err, res) {});
Any help is appreciated, thanks in advance