OptionsRequest
The OPTIONS method requests information about the communication options available for the target resource, at either the origin server or an intervening intermediary. This method allows a client to determine the options and/or requirements associated with a resource, or the capabilities of a server, without implying a resource action.
Extends:
Examples:
import { Actor } from '@serenity-js/core';
import { CallAnApi, OptionsRequest, 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(OptionsRequest.to('/downloads/my-test-document.pdf')),
Ensure.that(LastResponse.status(), equals(200)),
Ensure.that(LastResponse.header('Allow'), equals('OPTIONS, GET, HEAD')),
);
Tests:
Static Method Summary
Static Public Methods | ||
public static |
to(resourceUri: Answerable<string>): OptionsRequest Configures the object with a destination URI. |
Method Summary
Public Methods | ||
public |
using(config: Answerable<AxiosRequestConfig>): OptionsRequest |
Inherited Summary
From class HTTPRequest | ||
public |
subject: string |
|
public |
answeredBy(actor: AnswersQuestions & UsesAbilities): Promise<AxiosRequestConfig> |
Static Public Methods
public static to(resourceUri: Answerable<string>): OptionsRequest source
Configures the object with a destination URI.
When the resourceUri
is not a fully qualified URL but a path, such as /products/2
,
it gets concatenated with the URL provided to the Axios instance
when the CallAnApi Ability was instantiated.
Params:
Name | Type | Attribute | Description |
resourceUri | Answerable<string> | The URI where the Actor should send the HTTPRequest. |
Public Methods
public using(config: Answerable<AxiosRequestConfig>): OptionsRequest source
Params:
Name | Type | Attribute | Description |
config | Answerable<AxiosRequestConfig> | Axios request configuration overrides |