This step definition is used to verify the HTTP status code returned by an API request. It ensures that the API responds with the expected success or error code, like 200 for success or 404 for “not found.”
Then (?:the )?API response code should be (\d+)$
Checks that the response from the last API request matches the expected status code.
Example #1: Then the API response code should be 200
Example #2: Then API response code should be 404