diff --git a/src/JsonApiClient.php b/src/JsonApiClient.php index 8caa2a3..00eaf67 100644 --- a/src/JsonApiClient.php +++ b/src/JsonApiClient.php @@ -180,9 +180,12 @@ protected function createRequest( $prefix = null; if (array_key_exists('path', $url)) { $prefix = trim($url['path'], '/'); + if (!empty($prefix)) { + $prefix .= '/'; + } } - $requestUri = $requestUri->withPath($prefix . '/' . trim($requestUri->getPath(), '/')); + $requestUri = $requestUri->withPath('/' . $prefix . trim($requestUri->getPath(), '/')); return new Request($method, $requestUri, $body, $prefix); }