The Patch
class provides a convenient way to perform HTTP PATCH requests. It allows customization of data, headers, and the format of the response body, offering flexibility in testing scenarios. This class extends the abstract ARequest
class.
This class extends the ARequest
abstract class, providing a specific implementation for sending HTTP PATCH requests.
public async performAs(actor: Actor): Promise<Response>;
- Description: Send an HTTP PATCH request to the specified URL.
- Parameters:
actor
- The actor performing the action.
- Returns:
Promise<Response>
- The response object.
public static to(url: string): Patch;
- Description: Create a new instance of the
Patch
class with the specified URL. - Parameters:
url
- The URL of the target.
- Returns:
Patch
- A new instance of thePatch
class.
public withData(data: any): Patch;
- Description: Add data to the HTTP PATCH request.
- Parameters:
data
- The data to be added.
- Returns:
Patch
- The updated instance of thePatch
class.
public withHeaders(headers: Headers): Patch;
- Description: Add headers to the HTTP PATCH request.
- Parameters:
headers
- The headers to be added.
- Returns:
Patch
- The updated instance of thePatch
class.
public withResponseBodyFormat(responseBodyFormat: ResponseBodyFormat): Patch;
- Description: Set the format in which the response body should be returned.
- Parameters:
responseBodyFormat
- The desired format of the response body which can be one out ofjson
,text
,buffer
ornone
. The default isjson
.
- Returns:
Patch
- The updated instance of thePatch
class.
public withAbilityAlias(alias: string): Patch;
- Description: Defines the ability alias to be used during execution.
- Parameters:
alias
- The alias.
- Returns:
Patch
- Returns the current action.
Introduced in: 1.6.0
public get orSkipOnFail(): Patch;
- Description: Allows to skip an action on fail.
- Returns:
Patch
- Returns the current action.