feat: add client method to BaseIntegrationService for pre-configured HTTP client and implement test for client functionality
This commit is contained in:
@@ -4,6 +4,8 @@ namespace App\Domains\Integration\Services;
|
||||
|
||||
use App\Domains\Integration\Models\Integration;
|
||||
use App\Domains\Integration\Models\TenantIntegration;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Http\Client\PendingRequest;
|
||||
use Exception;
|
||||
|
||||
abstract class BaseIntegrationService
|
||||
@@ -132,6 +134,18 @@ abstract class BaseIntegrationService
|
||||
return $this->tenantIntegration->integration_data[$key] ?? $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a pre-configured HTTP client builder.
|
||||
*
|
||||
* @return PendingRequest
|
||||
* @throws Exception
|
||||
*/
|
||||
public function client(): PendingRequest
|
||||
{
|
||||
return Http::baseUrl($this->getUrl())
|
||||
->withHeaders($this->getHeaders());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the headers for the integration.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user