nerdexam
Check_Point

156-521 · Question #186

What should be added in Postman's "Tests" tab after a login request to capture the session token?

The correct answer is C. pm.environment.set("session", pm.response.json().sid). The correct script is pm.environment.set("session", pm.response.json().sid);, which extracts the session token from the response and stores it as a reusable environment variable.

Security Management API Operations

Question

What should be added in Postman's "Tests" tab after a login request to capture the session token?

Options

  • Aconsole.log("token");
  • Bvar token = request.token
  • Cpm.environment.set("session", pm.response.json().sid);
  • Dpostman.setGlobal("token", true);

How the community answered

(29 responses)
  • A
    7% (2)
  • B
    3% (1)
  • C
    76% (22)
  • D
    14% (4)

Explanation

The correct script is pm.environment.set("session", pm.response.json().sid);, which extracts the session token from the response and stores it as a reusable environment variable.

Topics

#Postman test scripts#session capture#pm.environment.set#sid

Community Discussion

No community discussion yet for this question.

Full 156-521 Practice