HttpRequestTrait
HTTP request helper methods for integration tests.
Tags
Table of Contents
- $httpService : HttpService|null
- HTTP service
- getExtraVuFindHttpRequestHeaders() : array<string|int, mixed>
- Get extra HTTP headers to support testing.
- getHttpService() : HttpService
- Get HTTP service.
- httpGet() : Response
- Perform an HTTP GET operation with coverage awareness.
- httpPost() : Response
- Perform an HTTP POST operation with coverage awareness.
Properties
$httpService
HTTP service
protected
HttpService|null
$httpService
= null
Methods
getExtraVuFindHttpRequestHeaders()
Get extra HTTP headers to support testing.
protected
getExtraVuFindHttpRequestHeaders() : array<string|int, mixed>
Return values
array<string|int, mixed> —getHttpService()
Get HTTP service.
protected
getHttpService() : HttpService
Return values
HttpService —httpGet()
Perform an HTTP GET operation with coverage awareness.
protected
httpGet(string $url[, array<string|int, mixed> $params = [] ][, float $timeout = null ][, array<string|int, mixed> $headers = [] ]) : Response
Parameters
- $url : string
-
Request URL
- $params : array<string|int, mixed> = []
-
Request parameters
- $timeout : float = null
-
Request timeout in seconds
- $headers : array<string|int, mixed> = []
-
Request headers
Return values
Response —httpPost()
Perform an HTTP POST operation with coverage awareness.
protected
httpPost(string $url[, mixed $body = null ][, string $type = 'application/octet-stream' ][, float $timeout = null ][, array<string|int, mixed> $headers = [] ]) : Response
Parameters
- $url : string
-
Request URL
- $body : mixed = null
-
Request body document
- $type : string = 'application/octet-stream'
-
Request body content type
- $timeout : float = null
-
Request timeout in seconds
- $headers : array<string|int, mixed> = []
-
Request http-headers