add Accept header

This commit is contained in:
korelstar 2021-05-02 09:18:29 +02:00
parent ee4430945d
commit 516bc00a98
4 changed files with 4 additions and 3 deletions

View File

@ -93,7 +93,7 @@ Therefore running Nextcloud **with SSL is highly recommended** otherwise **every
You can test your request using `curl`:
curl -u user:password https://yournextcloud.com/index.php/apps/notes/api/v1/notes
curl -u user:password -H "Accept: application/json" https://yournextcloud.com/index.php/apps/notes/api/v1/notes
If you have enabled two-factor authentication you will have to create an app specific password for accessing the API. Please see [Nextcloud documentation](https://docs.nextcloud.com/server/latest/user_manual/session_management.html) for further details.

View File

@ -47,7 +47,7 @@ The base URL for all calls is:
All defined routes in the specification are appended to this url. To access all notes for instance use this url (here shown as `curl` command):
curl -u user:password https://yournextcloud.com/index.php/apps/notes/api/v1/notes
curl -u user:password -H "Accept: application/json" https://yournextcloud.com/index.php/apps/notes/api/v1/notes

View File

@ -29,6 +29,7 @@ abstract class AbstractAPITest extends TestCase {
'base_uri' => 'http://localhost:8080/index.php/apps/notes/api/v'.$v.'/',
'auth' => ['test', 'test'],
'http_errors' => false,
'headers' => ['Accept' => 'application/json'],
]);
}

View File

@ -14,6 +14,7 @@ class CapabilitiesTest extends TestCase {
'base_uri' => 'http://localhost:8080/',
'auth' => ['test', 'test'],
'http_errors' => false,
'headers' => ['Accept' => 'application/json'],
]);
}
@ -21,7 +22,6 @@ class CapabilitiesTest extends TestCase {
$response = $this->http->request('GET', 'ocs/v2.php/cloud/capabilities', [
'headers' => [
'OCS-APIRequest' => 'true',
'Accept' => 'application/json',
]
]);
$this->assertEquals(200, $response->getStatusCode(), 'Response status code');