Use this tag for issues with pre-request scripts in postman, use the "postman" tag for general issues
Questions tagged [postman-pre-request-script]
319 questions
-1
votes
2 answers
how get this specific format of date in pre-request of postman
I have this in c#:
var date = DateTime.UtcNow.ToString("R", CultureInfo.InvariantCulture);
and the result is like this:
date = "Tue, 27 Dec 2022 13:30:35 GMT";
I want to have this result in pre-request of postman to pass this variable as date.
But…

N.Abdolalizadeh
- 73
- 11
-1
votes
1 answer
How to pass global variables to JSON object for validation in Javascript
Hello I am now to javascript and writing script for API testing in Postman to automate my usecases.
Need help for below query.
Lets say i have my API request as below.
API request: https://reqres.in/api/users/2
Response:
{
"data":{
…

Driod
- 23
- 6
-1
votes
1 answer
Postman giving 400 for pm.sendRequest
When I am running below send request from Postman - Tests, getting 400 bad request.
Could anyone tell me where I am wrong in sending the request?
let loginRequest = {
url: new_url,
method: 'POST',
headers: {
…

Manish Katepallewar
- 13
- 5
-4
votes
1 answer
unable to access json response in postman pre requisite script
In pre requesite script ,send a request and it is giving 200 status code and res.json() used but it is showing undefined
I tried var r =res.json()
console.log(r) but it is giving undefined

Baskaran S
- 1
- 1