From 651b0b2ceb165e05ceb3e87662f620a805e1106a Mon Sep 17 00:00:00 2001 From: Ruslan Abelkharisov Date: Mon, 17 Oct 2022 14:01:07 +0300 Subject: [PATCH 1/2] support custom gitlab installations with url like host/some/path/to/gitlab --- src/Api/AbstractApi.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Api/AbstractApi.php b/src/Api/AbstractApi.php index 5c81d6fd..95ed1376 100644 --- a/src/Api/AbstractApi.php +++ b/src/Api/AbstractApi.php @@ -36,7 +36,7 @@ abstract class AbstractApi * * @var string */ - private const URI_PREFIX = '/api/v4/'; + private const URI_PREFIX = 'api/v4/'; /** * The client instance. From bdf96e5b5ed8c97e55647dbfdc9902a01bbb465e Mon Sep 17 00:00:00 2001 From: Ruslan Abelkharisov Date: Mon, 17 Oct 2022 15:49:03 +0300 Subject: [PATCH 2/2] support custom gitlab installations with url like host/some/path/to/gitlab --- src/Api/AbstractApi.php | 2 +- src/Client.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Api/AbstractApi.php b/src/Api/AbstractApi.php index 95ed1376..5c81d6fd 100644 --- a/src/Api/AbstractApi.php +++ b/src/Api/AbstractApi.php @@ -36,7 +36,7 @@ abstract class AbstractApi * * @var string */ - private const URI_PREFIX = 'api/v4/'; + private const URI_PREFIX = '/api/v4/'; /** * The client instance. diff --git a/src/Client.php b/src/Client.php index 872d8369..4c750d03 100644 --- a/src/Client.php +++ b/src/Client.php @@ -50,7 +50,7 @@ use Gitlab\HttpClient\Plugin\ExceptionThrower; use Gitlab\HttpClient\Plugin\History; use Http\Client\Common\HttpMethodsClientInterface; -use Http\Client\Common\Plugin\AddHostPlugin; +use Http\Client\Common\Plugin\BaseUriPlugin; use Http\Client\Common\Plugin\HeaderDefaultsPlugin; use Http\Client\Common\Plugin\HistoryPlugin; use Http\Client\Common\Plugin\RedirectPlugin; @@ -415,8 +415,8 @@ public function setUrl(string $url): void { $uri = $this->getHttpClientBuilder()->getUriFactory()->createUri($url); - $this->getHttpClientBuilder()->removePlugin(AddHostPlugin::class); - $this->getHttpClientBuilder()->addPlugin(new AddHostPlugin($uri)); + $this->getHttpClientBuilder()->removePlugin(BaseUriPlugin::class); + $this->getHttpClientBuilder()->addPlugin(new BaseUriPlugin($uri)); } /**