generated from spatie/package-skeleton-laravel
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding view payload and sending xml options
- Loading branch information
1 parent
8a1e2fa
commit fba0df2
Showing
7 changed files
with
227 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
parameters: | ||
paths: | ||
- src | ||
level: 9 | ||
checkMissingIterableValueType: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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(), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.