kyle 2 years ago
parent
commit
70462a63cf
1 changed files with 28 additions and 0 deletions
  1. 28
    0
      app/Http/Services/Web/Api2021Service.php

+ 28
- 0
app/Http/Services/Web/Api2021Service.php View File

@@ -293,6 +293,34 @@ class Api2021Service
293 293
                 ],
294 294
                 'timeout' => 60, // Response timeout
295 295
                 'connect_timeout' => 30, // Connection timeout
296
+//                'on_headers' => function (\Psr\Http\Message\ResponseInterface $response) {
297
+//                    if ($response->getHeaderLine('Content-Length') > 1024) {
298
+//                        throw new \Exception('The file is too big!');
299
+//                    }
300
+//                },
301
+                'on_stats' => function (\GuzzleHttp\TransferStats $stats) {
302
+//                    echo $stats->getEffectiveUri() . "\n";
303
+//                    echo $stats->getTransferTime() . "\n";
304
+//                    var_dump($stats->getHandlerStats());
305
+
306
+                    $this->debuglog('lineFriendCheck-on_stats', [
307
+                        'rqid' => $rqid ?? 0
308
+                    ], [
309
+                        'transferTime' => $stats->getTransferTime(),
310
+                        'handlerStats' => $stats->getHandlerStats(),
311
+                    ]);
312
+
313
+                    // You must check if a response was received before using the
314
+                    // response object.
315
+//                    if ($stats->hasResponse()) {
316
+//                        echo $stats->getResponse()->getStatusCode();
317
+//                    } else {
318
+//                        // Error data is handler specific. You will need to know what
319
+//                        // type of error data your handler uses before using this
320
+//                        // value.
321
+//                        var_dump($stats->getHandlerErrorData());
322
+//                    }
323
+                }
296 324
             ];
297 325
 
298 326
             if (!in_array($_SERVER['SERVER_ADDR'], ['172.31.30.167', '172.31.9.233', '172.31.42.197'])) $req['proxy'] = env('CCH_PROXY');