Skip to content

Commit c58cd7f

Browse files
committed
* Implemented x-arango-version. Closes arangodb#160.
There is a minor backward incompatibility. We are now following ArangoDB's integer version numbering style. Instead of 1.4.0 we return 10400 when calling the Connection::getVersion() / getClientVersion() method. This has hopefully not any enormous impact. If it has please inform me so we can find a better solution...
1 parent f450d53 commit c58cd7f

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

lib/triagens/ArangoDb/Connection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Connection
2929
*
3030
* @var string
3131
*/
32-
public static $_apiVersion = '1.4.0';
32+
public static $_apiVersion = 10400;
3333

3434
/**
3535
* Connection options
@@ -425,7 +425,7 @@ public static function getVersion()
425425
*/
426426
public static function getClientVersion()
427427
{
428-
return self::$_apiVersion;
428+
return self::$_apiVersion;
429429
}
430430

431431

lib/triagens/ArangoDb/HttpHelper.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,12 @@ public static function buildRequest(ConnectionOptions $options, $method, $url, $
143143
$connection = sprintf("Connection: %s%s", $options[ConnectionOptions::OPTION_CONNECTION], self::EOL);
144144
}
145145

146+
$apiVersion = 'x-arango-version: ' . Connection::$_apiVersion . self::EOL;
147+
146148
// finally assemble the request
147149
$request = sprintf('%s %s %s%s', $method, $url, self::PROTOCOL, self::EOL) .
148150
$host .
151+
$apiVersion .
149152
$contentType .
150153
$authorization .
151154
$connection .

tests/ConnectionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ public function testGetApiVersion()
6565
$connection = getConnection();
6666

6767
$response = $connection->getVersion();
68-
$this->assertTrue($response !== "", 'Version String is empty!');
68+
$this->assertTrue($response >0, 'Version number is not correct!');
6969

7070
$response = $connection->getClientVersion();
71-
$this->assertTrue($response !== "", 'Version String is empty!');
71+
$this->assertTrue($response >0, 'Version number is not correct!');
7272
}
7373

7474
/**

0 commit comments

Comments
 (0)