Skip to content

Commit e901914

Browse files
authored
Merge pull request #4 from roygoldman/patch-1
If a prefix is being used, add a leading slash.
2 parents 7fa691d + 8e1d4ed commit e901914

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/JsonApiClient.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,12 @@ protected function createRequest(
180180
$prefix = null;
181181
if (array_key_exists('path', $url)) {
182182
$prefix = trim($url['path'], '/');
183+
if (!empty($prefix)) {
184+
$prefix .= '/';
185+
}
183186
}
184187

185-
$requestUri = $requestUri->withPath($prefix . '/' . trim($requestUri->getPath(), '/'));
188+
$requestUri = $requestUri->withPath('/' . $prefix . trim($requestUri->getPath(), '/'));
186189

187190
return new Request($method, $requestUri, $body, $prefix);
188191
}

0 commit comments

Comments
 (0)