generated from spatie/package-skeleton-laravel
/
SendsXml.php
40 lines (34 loc) · 758 Bytes
/
SendsXml.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
declare(strict_types=1);
namespace JustSteveKing\Transporter\Concerns;
use Illuminate\Http\Client\Response;
trait SendsXml
{
/**
* @param string $xml
* @return static
*/
public function withXml(string $xml): static
{
$this->request
->withHeaders(
headers: [
'Accept' => 'application/xml',
],
)->withBody(
content: $xml,
contentType: 'application/xml',
);
return $this;
}
/**
* @return Response
*/
public function send(): Response
{
return $this->request->send(
method: $this->method,
url: $this->getUrl(),
);
}
}