diff --git a/app/miniapi/service/CustomerCenter/CustomerCenterService.php b/app/miniapi/service/CustomerCenter/CustomerCenterService.php index f662049..dc70a87 100644 --- a/app/miniapi/service/CustomerCenter/CustomerCenterService.php +++ b/app/miniapi/service/CustomerCenter/CustomerCenterService.php @@ -32,10 +32,12 @@ final class CustomerCenterService return ''; } + $userUrl = rtrim(trim($userUrl), '/'); + $endpoint = preg_replace( '#/users/[^/?]+(?:\?.*)?$#i', '/customer_center/' . $action, - trim($userUrl) + $userUrl ); return is_string($endpoint) && $endpoint !== $userUrl ? $endpoint : ''; diff --git a/tests/customer_center_proxy_self_check.php b/tests/customer_center_proxy_self_check.php index 2398188..1e1936a 100644 --- a/tests/customer_center_proxy_self_check.php +++ b/tests/customer_center_proxy_self_check.php @@ -24,6 +24,11 @@ customerCenterProxyAssertSame( $service->endpoint('https://uniuser.jzvisa.com/home/users/userLogin', 'applications'), 'The proxy endpoint must stay on the configured unified API host' ); +customerCenterProxyAssertSame( + 'https://uniuser.jzvisa.com/home/customer_center/applicants', + $service->endpoint('https://uniuser.jzvisa.com/home/users/userLogin/', 'applicants'), + 'The proxy endpoint must accept the trailing slash used by the site configuration' +); customerCenterProxyAssertSame( '', $service->endpoint('https://example.com/unexpected', 'applications'),