Skip to content

Commit 4d17c39

Browse files
committed
Create getMessageFactory method so customzing the messagefactory is a little easier.
1 parent 0310a77 commit 4d17c39

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/ServiceProvider.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Http\Client\HttpClient;
77
use Http\Discovery\HttpClientDiscovery;
88
use Http\Discovery\MessageFactoryDiscovery;
9+
use Http\Message\MessageFactory;
910
use Illuminate\Foundation\Application;
1011
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
1112
use Swis\JsonApi\Client as ApiClient;
@@ -58,7 +59,7 @@ function () {
5859
return new ApiClient(
5960
$this->getHttpClient(),
6061
config('jsonapi.base_uri'),
61-
MessageFactoryDiscovery::find()
62+
$this->getMessageFactory()
6263
);
6364
}
6465
);
@@ -95,6 +96,16 @@ protected function getHttpClient(): HttpClient
9596
return HttpClientDiscovery::find();
9697
}
9798

99+
/**
100+
* Should return a MessageFactory which has 2 method. get.
101+
*
102+
* @return \Http\Message\MessageFactory
103+
*/
104+
protected function getMessageFactory(): MessageFactory
105+
{
106+
return MessageFactoryDiscovery::find();
107+
}
108+
98109
/**
99110
* @return FixturesClient
100111
*/

0 commit comments

Comments
 (0)