Skip to main content

Send

Sends a HTTPRequest to a specified URL.

The response to the request is made available via LastResponse.

Send a GET request

import { actorCalled } from '@serenity-js/core'
import { CallAnApi, GetRequest, LastResponse, Send } from '@serenity-js/rest'
import { Ensure, equals } from '@serenity-js/assertions'

await actorCalled('Apisitt')
.whoCan(CallAnApi.at('https://api.example.org/'))
.attemptsTo(
Send.a(GetRequest.to('/books/0-688-00230-7')),
Ensure.that(LastResponse.status(), equals(200)),
)

Hierarchy

  • Interaction
    • Send

Index

Methods

statica

  • a(request: Answerable<AxiosRequestConfig<any>>): Interaction

instantiationLocation

  • instantiationLocation(): FileSystemLocation
  • Returns the location where this Activity was instantiated.


    Returns FileSystemLocation

toString

  • toString(): string
  • Generates a human-friendly description to be used when reporting this Activity.

    Note: When this activity is reported, token #actor in the description will be replaced with the name of the actor performing this Activity.

    For example, #actor clicks on a button becomes Wendy clicks on a button.


    Returns string

performAs

  • performAs(actor: UsesAbilities & CollectsArtifacts & AnswersQuestions): Promise<void>
  • @inheritDoc

    Parameters

    • actor: UsesAbilities & CollectsArtifacts & AnswersQuestions

    Returns Promise<void>