Complete the code to set the next request to 'Login' if the status code is 401.
if (pm.response.code === [1]) { postman.setNextRequest('Login'); }
The status code 401 means unauthorized, so we set the next request to 'Login' to authenticate.
Complete the code to skip the next request by setting it to null when the response has status 204.
if (pm.response.code === [1]) { postman.setNextRequest(null); }
Status code 204 means No Content, so we skip the next request by setting it to null.
Fix the error in the code to correctly set the next request to 'GetUser' if the response JSON has 'userId' equal to 123.
let jsonData = pm.response.json(); if (jsonData.userId [1] 123) { postman.setNextRequest('GetUser'); }
Use '===' for strict equality comparison in JavaScript to avoid type coercion errors.
Fill both blanks to set the next request to 'Retry' if the response status is 500 and the retry count is less than 3.
let retryCount = pm.variables.get('[1]') || 0; if (pm.response.code === 500 && retryCount [2] 3) { postman.setNextRequest('Retry'); }
We get the retry count from variables and check if it is less than 3 to decide retrying.
Fill all three blanks to set the next request to 'Success' if the response code is 200 and the JSON field 'status' equals 'ok', otherwise set it to 'Failure'.
let data = pm.response.json(); if (pm.response.code === [1] && data.status [2] [3]) { postman.setNextRequest('Success'); } else { postman.setNextRequest('Failure'); }
Check if status code is 200 and status field strictly equals 'ok' to proceed to 'Success'.