Send
Sends a HTTPRequest to a specified url. The response to the request is made available via the LastResponse Questions.
Extends:
Examples:
import { Actor } from '@serenity-js/core';
import { CallAnApi, GetRequest, LastResponse, Send } from '@serenity-js/rest'
import { Ensure, equals } from '@serenity-js/assertions';
const actor = Actor.named('Apisit').whoCan(CallAnApi.at('https://myapp.com/api'));
actor.attemptsTo(
Send.a(GetRequest.to('/books/0-688-00230-7')),
Ensure.that(LastResponse.status(), equals(200)),
);
Tests:
Static Method Summary
Static Public Methods | ||
public static |
a(request: Answerable<AxiosRequestConfig>): Interaction Instantiates a new Send Interaction. |
Constructor Summary
Public Constructor | ||
public |
constructor(request: Answerable<AxiosRequestConfig>) |
Method Summary
Public Methods | ||
public |
performAs(actor: UsesAbilities & CollectsArtifacts & AnswersQuestions): Promise<void> Makes the provided Actor perform this Interaction. |
|
public |
toString(): string Generates a description to be used when reporting this Activity. |
Static Public Methods
public static a(request: Answerable<AxiosRequestConfig>): Interaction source
Instantiates a new Send Interaction.
Params:
Name | Type | Attribute | Description |
request | Answerable<AxiosRequestConfig> |
Tests:
Public Constructors
public constructor(request: Answerable<AxiosRequestConfig>) source
Params:
Name | Type | Attribute | Description |
request | Answerable<AxiosRequestConfig> |
Public Methods
public performAs(actor: UsesAbilities & CollectsArtifacts & AnswersQuestions): Promise<void> source
Makes the provided Actor perform this Interaction.
Params:
Name | Type | Attribute | Description |
actor | UsesAbilities & CollectsArtifacts & AnswersQuestions |
Returns:
Promise<void> |