Skip to content

Commit 9f9fa22

Browse files
committed
Request Options Support
1 parent 5cb4009 commit 9f9fa22

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

config/webpush.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,9 @@
3939
*/
4040
'database_connection' => env('WEBPUSH_DB_CONNECTION', env('DB_CONNECTION', 'mysql')),
4141

42+
/*
43+
* This is the configuration that will be use by Minishlink\WebPush to make http calls.
44+
* More specifically, this is the request option for Guzzle Client.
45+
*/
46+
'client_options' => [],
4247
];

src/WebPushServiceProvider.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function boot()
3030
$this->app->when(WebPushChannel::class)
3131
->needs(WebPush::class)
3232
->give(function () {
33-
$webPush = new WebPush($this->webPushConfig());
33+
$webPush = new WebPush($this->webPushConfig(), [], 30, $this->clientOptionsConfig());
3434
$webPush->setReuseVAPIDHeaders(true);
3535

3636
return $webPush;
@@ -44,7 +44,16 @@ public function boot()
4444
$this->definePublishing();
4545
}
4646
}
47-
47+
/**
48+
* Get Guzzle Request options from config file and
49+
* pass to WebPush.
50+
* @return array
51+
*/
52+
protected function clientOptionsConfig()
53+
{
54+
$webpush = config('webpush');
55+
return $webpush['client_options'];
56+
}
4857
/**
4958
* @return array
5059
*/

0 commit comments

Comments
 (0)