Complete the code to check if the response status code is 200.
pm.test("Status code is 200", function () { pm.response.to.have.status([1]); });
The status code 200 means the request was successful. We use pm.response.to.have.status(200) to assert this.
Complete the code to assert the response status code is 404.
pm.test("Status code is 404", function () { pm.response.to.have.status([1]); });
Status code 404 means the requested resource was not found. We assert it with pm.response.to.have.status(404).
Fix the error in the code to correctly assert status code 201.
pm.test("Status code is 201", function () { pm.response.to.have.status([1]); });
The status code should be a number, not a string. So use 201 without quotes.
Fill both blanks to assert the status code is greater than or equal to 200.
pm.test("Status code is success range", function () { pm.expect(pm.response.code).to.be.[1]([2]); });
equal instead of range checks.at.most with 200.Use at.least(200) to check the status code is 200 or more. To check less than 300, you would add another test.
Fill all three blanks to assert the status code is between 200 and 299 inclusive.
pm.test("Status code is 2xx", function () { pm.expect(pm.response.code).to.be.[1]([2]); pm.expect(pm.response.code).to.be.[3](299); });
equal instead of range checks.at.least and at.most.We check the status code is at least 200 and at most 299 to cover all 2xx success codes.