Query parameters in collections #2428
-
Hi, is there any way I can add a query parameter for all queries in a collection? |
Beta Was this translation helpful? Give feedback.
Answered by
CodeShakingSheep
Jun 11, 2024
Replies: 1 comment 2 replies
-
Hi @absid89 , const queryParam = "page=3";
req.setUrl(req.getUrl().includes("?") ? req.getUrl() + "&" + queryParam : req.getUrl() + "?" + queryParam); Collection pre request script: Request timeline with appended query parameter: You can see that the query parameter defined in pre request script is appended to the end of the URL. Hope this helps. Cheers. |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
absid89
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @absid89 ,
I just found a solution to your question. In a collection you can write a pre request script like this.
Collection pre request script:
Request timeline with appended query parameter:
You can see that the query parameter defined in pre request script is appended to the end of the URL.
Hope this helps. Cheers.