Json drill for coreApiCapabilities Suite (#5672)
Refactor acording to core Signed-off-by: sagargurung1001@gmail.com <sagargurung1001@gmail.com> Review Address Co-authored-by: sagargurung1001@gmail.com <sagargurung1001@gmail.com>
This commit is contained in:
co-authored by
sagargurung1001@gmail.com <sagargurung1001@gmail.com>
parent
5902679277
commit
0c4f53a03e
@@ -931,12 +931,17 @@ class OCSContext implements Context {
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getOCSResponseStatusCode(ResponseInterface $response):string {
|
||||
$jsonResponse = $this->featureContext->getJsonDecodedResponseBodyContent($response);
|
||||
if (\is_object($jsonResponse) && $jsonResponse->ocs->meta->statuscode) {
|
||||
return (string) $jsonResponse->ocs->meta->statuscode;
|
||||
}
|
||||
// go to xml response when json response is null (it means not formated and get status code)
|
||||
$responseXml = $this->featureContext->getResponseXml($response, __METHOD__);
|
||||
if (isset($responseXml->meta[0], $responseXml->meta[0]->statuscode)) {
|
||||
return (string) $responseXml->meta[0]->statuscode;
|
||||
}
|
||||
throw new Exception(
|
||||
"No OCS status code found in responseXml"
|
||||
"No OCS status code found in response"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user