diff --git a/src/Surfnet/ServiceProviderDashboard/Infrastructure/Invite/InviteHttpClient.php b/src/Surfnet/ServiceProviderDashboard/Infrastructure/Invite/InviteHttpClient.php index 45266647e..e7b778d4d 100644 --- a/src/Surfnet/ServiceProviderDashboard/Infrastructure/Invite/InviteHttpClient.php +++ b/src/Surfnet/ServiceProviderDashboard/Infrastructure/Invite/InviteHttpClient.php @@ -43,8 +43,10 @@ public function __construct( ], ]; + $baseUri = InviteHttpClientUrlSanitizer::buildBaseUri($path, $host); + $this->httpClient = HttpClient::createForBaseUri( - $host . $path, + $baseUri, $options ); } @@ -54,6 +56,7 @@ public function __construct( */ public function post(string $path, array $payload): ResponseInterface { + $path = InviteHttpClientUrlSanitizer::ensureRelativePath($path); return $this->httpClient->request( 'POST', $path, @@ -66,6 +69,7 @@ public function post(string $path, array $payload): ResponseInterface */ public function delete(string $path): ResponseInterface { + $path = InviteHttpClientUrlSanitizer::ensureRelativePath($path); return $this->httpClient->request( 'DELETE', $path, diff --git a/src/Surfnet/ServiceProviderDashboard/Infrastructure/Invite/InviteHttpClientUrlSanitizer.php b/src/Surfnet/ServiceProviderDashboard/Infrastructure/Invite/InviteHttpClientUrlSanitizer.php new file mode 100644 index 000000000..d04651373 --- /dev/null +++ b/src/Surfnet/ServiceProviderDashboard/Infrastructure/Invite/InviteHttpClientUrlSanitizer.php @@ -0,0 +1,52 @@ +