Answer the question
In order to leave comments, you need to log in
Codeception how to check for existence of keys in JSON response?
Here is a test response:
{"code":1,"status":200,"message":"Шаблон ответа","data":{"test-1":1,"test-2":2,"test-3":3}}
$I = new ApiTester($scenario);
$I->sendGET('test-response');
$I->seeResponseCodeIs(200);
$I->haveHttpHeader('Content-Type','application/json');
$I->seeResponseIsJson();
$I->seeResponseContainsJson([
'code' => 1,
'status' => 200,
'message' => 'Шаблон ответа',
]);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question