HasBody
trait HasBody
Properties
| protected BodyRepository|null | $bodyRepository | The request body repository. |
Methods
withBody(mixed $content, string|null $contentType = 'application/json')
Set the raw request body.
asMultipart()
Use a multipart request body.
attach(string $name, mixed $contents = '', string|null $filename = null, array $headers = [])
Attach a multipart value to the request.
mixed
body()
Get the resolved request body value.
bool
hasBody()
Determine if the request has a body repository.
BodyRepository|null
copyBodyRepository()
Copy the body repository for a pending request.
BodyRepository|null
defaultBodyRepository()
Resolve the default body repository.
BodyRepository|null
bodyRepository()
Get the request body repository.
Details
at line 31
HasBody
withBody(mixed $content, string|null $contentType = 'application/json')
Set the raw request body.
at line 50
HasBody
asJson(array $data = [])
Use a JSON request body.
at line 63
HasBody
asForm(array $data = [])
Use a URL-encoded form request body.
at line 75
HasBody
asMultipart()
Use a multipart request body.
at line 89
HasBody
attach(string $name, mixed $contents = '', string|null $filename = null, array $headers = [])
Attach a multipart value to the request.
at line 112
HasBody
withData(array $data)
Merge structured values into the request body.
at line 129
mixed
body()
Get the resolved request body value.
at line 137
bool
hasBody()
Determine if the request has a body repository.
at line 147
final BodyRepository|null
copyBodyRepository()
| internal |
Copy the body repository for a pending request.
at line 157
protected BodyRepository|null
defaultBodyRepository()
Resolve the default body repository.
at line 165
protected BodyRepository|null
bodyRepository()
Get the request body repository.