Http Status Codes

You can declaratively check the status code with this syntax:

public Task check_the_status(IAlbaHost system)
{
    return system.Scenario(_ =>
    {
        // Shorthand for saying that the StatusCode should be 200
        _.StatusCodeShouldBeOk();

        // Or a specific status code
        _.StatusCodeShouldBe(403);

        // Ignore the status code altogether
        _.IgnoreStatusCode();
    });
}

snippet source | anchor

Do note that by default, if you do not specify the expected status code, Alba assumes that the request should return 200 (OK) and will fail the scenario if a different status code is found. You can ignore that check with the Scenario.IgnoreStatusCode() method.