RequestBase
in package
implements
RequestInterface
Functions shared across both HTTP and WebSocket requests.
Interfaces, Classes, Traits and Enums
- RequestInterface
Table of Contents
- addCapture() : $this
- Adds a capture to the request to parse responses and re-use those values in subsequent requests as '{{ alias }}'.
- addCaptures() : $this
- Adds an array of capture objects to the request.
- addExpect() : $this
- Adds an expectation assertion to the request.
- addExpects() : $this
- Adds an array of expectation assertions to the request.
- addMatch() : $this
- Adds a matching statement to the request, similar to a capture but without an 'as' alias.
- addMatches() : $this
- Adds an array of matching statement to the request, similar to a capture but without an 'as' alias.
- set() : $this
- Set arbitrary data in the request, such as those from third party extension.
- setMethod() : $this
- Set the method of this request, eg 'put', 'think', 'emit', etc.
- setRequest() : $this
- Completely override the request data for this request.
Methods
addCapture()
Adds a capture to the request to parse responses and re-use those values in subsequent requests as '{{ alias }}'.
public
addCapture(string $as, string $type, string $expression[, bool $strict = true ][, string|null $attr = null ][, int|string $index = null ]) : $this
Parameters
- $as : string
-
Captured data alias.
- $type : string
- $expression : string
-
Capture expression.
- $strict : bool = true
-
Whether to throw an error if the capture expression does not match anything.
- $attr : string|null = null
-
If $type is 'selector': The name of the attribute whose value we want.
- $index : int|string = null
Tags
Return values
$this —The current Request instance.
addCaptures()
Adds an array of capture objects to the request.
public
addCaptures(array<string|int, mixed> $captures) : $this
Parameters
- $captures : array<string|int, mixed>
Tags
Return values
$this —The current Request instance.
addExpect()
Adds an expectation assertion to the request.
public
addExpect(string $type, mixed $value[, mixed $equals = null ]) : $this
Parameters
- $type : string
- $value : mixed
-
The value(s) to expect.
- $equals : mixed = null
-
Equals can be added after hasHeader and hasProperty to do an equality check.
Tags
Return values
$this —The current Request instance.
addExpects()
Adds an array of expectation assertions to the request.
public
addExpects(array<string|int, mixed> $expects) : $this
Parameters
- $expects : array<string|int, mixed>
Tags
Return values
$this —The current Request instance.
addMatch()
Adds a matching statement to the request, similar to a capture but without an 'as' alias.
public
addMatch(string $type, string $expression, mixed $value[, bool $strict = true ][, string $attr = null ][, int|string $index = null ]) : $this
Parameters
- $type : string
- $expression : string
-
The capture expression.
- $value : mixed
-
The value to match against the capture.
- $strict : bool = true
- $attr : string = null
- $index : int|string = null
Tags
Return values
$this —The current Request instance.
addMatches()
Adds an array of matching statement to the request, similar to a capture but without an 'as' alias.
public
addMatches(array<string|int, mixed> $matches) : $this
Parameters
- $matches : array<string|int, mixed>
Tags
Return values
$this —The current Request instance.
set()
Set arbitrary data in the request, such as those from third party extension.
public
set(string $key, mixed $data) : $this
Parameters
- $key : string
- $data : mixed
-
Arbitrary data to add to the request.
Tags
Return values
$this —The current Request instance.
setMethod()
Set the method of this request, eg 'put', 'think', 'emit', etc.
public
setMethod(string $method) : $this
Parameters
- $method : string
-
The HTTP method for this request.
Return values
$this —The current Request instance.
setRequest()
Completely override the request data for this request.
public
setRequest(mixed $request) : $this
Parameters
- $request : mixed
-
The request data.
Return values
$this —The current Request instance.