An HTTP server can answer a request with a status your application didn't expect. On the Linux desktop, Postman can check that status in an API test and show whether the response meets your expectation.
A status test runs after the response arrives. It checks the HTTP code the server sent. A 200 OK response can pass that assertion even when a field in the response body has the wrong value.
The Lightweight API Client runs test scripts on an open request without a Postman account. You can send the same request again to see whether a later response still meets the assertion.
Steps to write an API test in Postman:
Start in the Lightweight API Client's default layout with a new HTTP request set to GET and an empty Tests editor. Use a read-only endpoint you can call that normally returns 200. For the failure check, use a second read-only URL you control that returns a status other than 200 directly to Postman, such as 503. Avoid 3xx redirects because Postman follows them by default and may end up with a 200 response.
- Click the URL field beside GET.
An empty field shows Enter URL or paste text.
- Enter the URL of your endpoint that returns
200.
The example uses the following URL.
https://api.example.test/v1/status
- Open the request's Tests tab.

- Select Status code: Code is 200 in Snippets.
pm.test("Status code is 200", function () { pm.response.to.have.status(200); });
The name passed to
pm.testappears in Test Results. The line inside the function compares the response's status with200. - Click Send to run the request with the new assertion.

- Open Test Results in the response pane after the response arrives.

- Confirm that Status code is 200 shows PASS.

- Click the URL field beside GET.

- Select the current URL with Ctrl+A.

- Enter your second URL in place of the selected URL.
This URL must return a direct non-200 response without a
3xxredirect. The example returns503.https://api.example.test/v1/status/503
- Click Send to run the unchanged assertion against the new response.

- Confirm that Status code is 200 now shows FAIL in Test Results.
The failure message gives the expected and received status codes. In the example it reports
200and503. - Click the URL field beside GET.

- Select the non-200 URL with Ctrl+A.

- Enter your original endpoint's URL in place of the selected URL.

- Click Send to rerun the test on your original endpoint.

- Verify that Status code is 200 shows PASS again in Test Results.
