From 57dddd93a25b5dd0f849dab2291cc188e5b4c6eb Mon Sep 17 00:00:00 2001 From: Pavle Predic Date: Fri, 12 Jan 2018 13:57:46 +0100 Subject: [PATCH] Add a method for getting response as string --- src/Context/WebApiContext.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Context/WebApiContext.php b/src/Context/WebApiContext.php index fa008df..e940ea5 100644 --- a/src/Context/WebApiContext.php +++ b/src/Context/WebApiContext.php @@ -304,6 +304,18 @@ public function printResponse() ); } + /** + * Returns the response as a string. + * + * @return string + */ + public function getResponseAsString() + { + if ($this->response) { + return (string) $this->response->getBody(); + } + } + /** * Prepare URL by replacing placeholders and trimming slashes. *