PatchRequest
The PATCH method requests that a set of changes described in the
request entity be applied to the resource identified by the resourceUri
.
Extends:
Examples:
import { Actor } from '@serenity-js/core';
import { CallAnApi, LastResponse, PatchRequest, 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(PatchRequest.to('/books/0-688-00230-7').with({
lastReadOn: '2016-06-16',
})),
Ensure.that(LastResponse.status(), equals(204)),
);
Tests:
Static Method Summary
Static Public Methods | ||
public static |
to(resourceUri: Answerable<string>): PatchRequest Configures the object with a destination URI. |
Method Summary
Public Methods | ||
public |
using(config: Answerable<AxiosRequestConfig>): PatchRequest |
|
public |
with(data: Answerable<any>): PatchRequest Configures the object with a request body. |
Inherited Summary
From class HTTPRequest | ||
public |
subject: string |
|
public |
answeredBy(actor: AnswersQuestions & UsesAbilities): Promise<AxiosRequestConfig> |
Static Public Methods
public static to(resourceUri: Answerable<string>): PatchRequest 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>): PatchRequest source
Params:
Name | Type | Attribute | Description |
config | Answerable<AxiosRequestConfig> | Axios request configuration overrides |
public with(data: Answerable<any>): PatchRequest source
Configures the object with a request body.
Params:
Name | Type | Attribute | Description |
data | Answerable<any> | Data to be sent to the |