fix(provider): dedoupet base URL is properly formatted in GitLab and Gitea providers
This commit is contained in:
@@ -26,7 +26,9 @@ final class GiteaProvider implements ProviderInterface
|
||||
private readonly string $token,
|
||||
private readonly string $baseUrl,
|
||||
private readonly LoggerInterface $logger,
|
||||
) {}
|
||||
) {
|
||||
$this->baseUrl = rtrim($this->baseUrl, '/');
|
||||
}
|
||||
|
||||
public function getName(): string
|
||||
{
|
||||
@@ -40,20 +42,20 @@ final class GiteaProvider implements ProviderInterface
|
||||
|
||||
public function ping(): void
|
||||
{
|
||||
$baseUrl = rtrim($this->baseUrl, '/');
|
||||
|
||||
|
||||
$this->client->request('GET', "$baseUrl/api/v1/user", [
|
||||
$this->client->request('GET', "$this->baseUrl/api/v1/user", [
|
||||
'headers' => ['Authorization' => "token {$this->token}"],
|
||||
])->getContent();
|
||||
}
|
||||
|
||||
public function startFetch(): ResponseInterface
|
||||
{
|
||||
$baseUrl = rtrim($this->baseUrl, '/');
|
||||
|
||||
|
||||
$this->logger->debug('GiteaProvider: fetching contributions', ['user' => $this->username, 'url' => $baseUrl]);
|
||||
$this->logger->debug('GiteaProvider: fetching contributions', ['user' => $this->username, 'url' => $this->baseUrl]);
|
||||
|
||||
return $this->client->request('GET', "$baseUrl/api/v1/users/{$this->username}/heatmap", [
|
||||
return $this->client->request('GET', "$this->baseUrl/api/v1/users/{$this->username}/heatmap", [
|
||||
'headers' => ['Authorization' => "token {$this->token}"],
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user