File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,13 @@ class Webhook implements Listener, Logger
4343 */
4444 private $ method ;
4545
46+ /**
47+ * Request timeout (seconds)
48+ *
49+ * @var int
50+ */
51+ private $ timeout ;
52+
4653 /**
4754 * Basic auth username
4855 *
@@ -127,6 +134,7 @@ public function setup(array $options)
127134 $ this ->password = Arr::getValue ($ options , 'password ' , '' );
128135 $ this ->template = Arr::getValue ($ options , 'template ' , '' );
129136 $ this ->contentType = Arr::getValue ($ options , 'contentType ' , 'multipart/form-data ' );
137+ $ this ->timeout = Arr::getValue ($ options , 'timeout ' , '' );
130138 }
131139
132140 /**
@@ -219,6 +227,10 @@ protected function fireRequest(string $uri, string $body = '')
219227 $ options ['http ' ]['content ' ] = $ body ;
220228 }
221229
230+ if (!empty ($ this ->timeout )) {
231+ $ options ['http ' ]['timeout ' ] = $ this ->timeout ;
232+ }
233+
222234 if (!empty ($ this ->username )) {
223235 $ headers [] = 'Authorization: Basic ' . base64_encode ($ this ->username . ': ' . $ this ->password );
224236 }
You can’t perform that action at this time.
0 commit comments