Skip to content

Commit

Permalink
Merge pull request #4 from roygoldman/patch-1
Browse files Browse the repository at this point in the history
If a prefix is being used, add a leading slash.
  • Loading branch information
pmarien authored Aug 29, 2019
2 parents 7fa691d + 8e1d4ed commit e901914
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/JsonApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit e901914

Please sign in to comment.