How to use the @serenity-js/rest.LastResponse.header function in @serenity-js/rest

To help you get started, we’ve selected a few @serenity-js/rest examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jan-molak / serenity-js / examples / cucumber-rest-api-level-testing / features / step_definitions / api-level.steps.ts View on Github external
Then(/(?:he|she|they) should get a result of ([\d-.]+)/, function (this: WithStage, expectedResult: string) {
    return this.stage.theActorInTheSpotlight().attemptsTo(
        VerifyResultAt(LastResponse.header('location'), equals({ result: Number(expectedResult) })),
    );
});
github jan-molak / serenity-js / examples / cucumber-rest-api-level-testing / features / support / screenplay / tasks / RequestCalculationOf.ts View on Github external
export const RequestCalculationOf = (expression: string) =>
    Task.where(`#actor requests calculation of ${ expression }`,
        Send.a(
            PostRequest.to('/api/calculations').with(expression).using({ headers: { 'Content-Type': 'text/plain' }}),
        ),
        Ensure.that(LastResponse.status(), equals(201)),
        Ensure.that(LastResponse.header('location'), startsWith('/api/calculations/')),
    );