Make param errors consistent
This commit is contained in:
parent
64ad2211c7
commit
44e4f1e05b
3 changed files with 9 additions and 9 deletions
|
@ -551,7 +551,7 @@ return [
|
||||||
],
|
],
|
||||||
Exception::GRAPHQL_NO_QUERY => [
|
Exception::GRAPHQL_NO_QUERY => [
|
||||||
'name' => Exception::GRAPHQL_NO_QUERY,
|
'name' => Exception::GRAPHQL_NO_QUERY,
|
||||||
'description' => 'No query passed in the request.',
|
'description' => 'Param "query" is not optional.',
|
||||||
'code' => 400,
|
'code' => 400,
|
||||||
],
|
],
|
||||||
Exception::GRAPHQL_INVALID_QUERY => [
|
Exception::GRAPHQL_INVALID_QUERY => [
|
||||||
|
|
|
@ -104,7 +104,7 @@ function executeRequest(
|
||||||
}
|
}
|
||||||
foreach ($query as $item) {
|
foreach ($query as $item) {
|
||||||
if (empty($item['query'])) {
|
if (empty($item['query'])) {
|
||||||
throw new Exception(Exception::GRAPHQL_INVALID_QUERY);
|
throw new Exception(Exception::GRAPHQL_NO_QUERY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -162,7 +162,7 @@ class ContentTypeTest extends Scope
|
||||||
'x-appwrite-project' => $projectId,
|
'x-appwrite-project' => $projectId,
|
||||||
], $this->getHeaders()));
|
], $this->getHeaders()));
|
||||||
|
|
||||||
$this->assertEquals('No query passed in the request.', $response['body']['message']);
|
$this->assertEquals('Param "query" is not optional.', $response['body']['message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testPostEmptyBody()
|
public function testPostEmptyBody()
|
||||||
|
@ -173,7 +173,7 @@ class ContentTypeTest extends Scope
|
||||||
'x-appwrite-project' => $projectId,
|
'x-appwrite-project' => $projectId,
|
||||||
], $this->getHeaders()), []);
|
], $this->getHeaders()), []);
|
||||||
|
|
||||||
$this->assertEquals('No query passed in the request.', $response['body']['message']);
|
$this->assertEquals('Param "query" is not optional.', $response['body']['message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testPostRandomBody()
|
public function testPostRandomBody()
|
||||||
|
@ -184,7 +184,7 @@ class ContentTypeTest extends Scope
|
||||||
'x-appwrite-project' => $projectId,
|
'x-appwrite-project' => $projectId,
|
||||||
], $this->getHeaders()), ['foo' => 'bar']);
|
], $this->getHeaders()), ['foo' => 'bar']);
|
||||||
|
|
||||||
$this->assertEquals('Invalid query.', $response['body']['message']);
|
$this->assertEquals('Param "query" is not optional.', $response['body']['message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetNoQuery()
|
public function testGetNoQuery()
|
||||||
|
@ -195,7 +195,7 @@ class ContentTypeTest extends Scope
|
||||||
'x-appwrite-project' => $projectId,
|
'x-appwrite-project' => $projectId,
|
||||||
], $this->getHeaders()));
|
], $this->getHeaders()));
|
||||||
|
|
||||||
$this->assertEquals('No query passed in the request.', $response['body']['message']);
|
$this->assertEquals('Param "query" is not optional.', $response['body']['message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetEmptyQuery()
|
public function testGetEmptyQuery()
|
||||||
|
@ -206,17 +206,17 @@ class ContentTypeTest extends Scope
|
||||||
'x-appwrite-project' => $projectId,
|
'x-appwrite-project' => $projectId,
|
||||||
], $this->getHeaders()));
|
], $this->getHeaders()));
|
||||||
|
|
||||||
$this->assertEquals('Invalid query.', $response['body']['message']);
|
$this->assertEquals('Param "query" is not optional.', $response['body']['message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetRandomParameters()
|
public function testGetRandomParameters()
|
||||||
{
|
{
|
||||||
$projectId = $this->getProject()['$id'];
|
$projectId = $this->getProject()['$id'];
|
||||||
$response = $this->client->call(Client::METHOD_POST, '/graphql?random=random', \array_merge([
|
$response = $this->client->call(Client::METHOD_GET, '/graphql?random=random', \array_merge([
|
||||||
'content-type' => 'application/json',
|
'content-type' => 'application/json',
|
||||||
'x-appwrite-project' => $projectId,
|
'x-appwrite-project' => $projectId,
|
||||||
], $this->getHeaders()));
|
], $this->getHeaders()));
|
||||||
|
|
||||||
$this->assertEquals('No query passed in the request.', $response['body']['message']);
|
$this->assertEquals('Param "query" is not optional.', $response['body']['message']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue