Skip to content

Commit 8d9b602

Browse files
authored
Merge pull request #199 from fbourigault/v4-endpoint
Set api endpoint to /api/v4
2 parents 0a46ae1 + 28c8256 commit 8d9b602

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/Gitlab/HttpClient/Plugin/ApiVersion.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use Psr\Http\Message\RequestInterface;
88

99
/**
10-
* Prefix requests path with /api/v3/ if required.
10+
* Prefix requests path with /api/v4/ if required.
1111
*
1212
* @author Fabien Bourigault <bourigaultfabien@gmail.com>
1313
*/
@@ -20,8 +20,8 @@ public function handleRequest(RequestInterface $request, callable $next, callabl
2020
{
2121
$uri = $request->getUri();
2222

23-
if (substr($uri->getPath(), 0, 8) !== '/api/v3/') {
24-
$request = $request->withUri($uri->withPath('/api/v3/'.$uri->getPath()));
23+
if (substr($uri->getPath(), 0, 8) !== '/api/v4/') {
24+
$request = $request->withUri($uri->withPath('/api/v4/'.$uri->getPath()));
2525
}
2626

2727
return $next($request);

test/Gitlab/Tests/HttpClient/Plugin/ApiVersionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function testCallNextCallback()
3333
public function testPrefixRequestPath()
3434
{
3535
$request = new Request('GET', 'projects');
36-
$expected = new Request('GET', '/api/v3/projects');
36+
$expected = new Request('GET', '/api/v4/projects');
3737
$plugin = new ApiVersion();
3838

3939
$callback = $this->getMockBuilder(\stdClass::class)
@@ -50,7 +50,7 @@ public function testPrefixRequestPath()
5050

5151
public function testNoPrefixingRequired()
5252
{
53-
$request = new Request('GET', '/api/v3/projects');
53+
$request = new Request('GET', '/api/v4/projects');
5454
$plugin = new ApiVersion();
5555

5656
$callback = $this->getMockBuilder(\stdClass::class)

0 commit comments

Comments
 (0)