From bf834150f621c6dc1e543d7058c1d069e46a6535 Mon Sep 17 00:00:00 2001 From: parsagholipour <57809920+parsagholipour@users.noreply.github.com> Date: Thu, 28 Jan 2021 23:45:53 +0330 Subject: [PATCH] Change toJson method (#48) add HTTP `application/json` header to the response which is generated by `toJson` --- src/RedirectionForm.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/RedirectionForm.php b/src/RedirectionForm.php index 4d0c4a2..9dde67b 100644 --- a/src/RedirectionForm.php +++ b/src/RedirectionForm.php @@ -3,6 +3,7 @@ namespace Shetabit\Multipay; use JsonSerializable; +use Illuminate\Support\Facades\Response; class RedirectionForm implements JsonSerializable { @@ -179,11 +180,11 @@ public function render() : string * * @param $options * - * @return string + * @return \Illuminate\Http\JsonResponse */ - public function toJson($options = JSON_UNESCAPED_UNICODE) : string + public function toJson($options = JSON_UNESCAPED_UNICODE) : \Illuminate\Http\JsonResponse { - return json_encode($this, $options); + return Response::json($this)->setEncodingOptions($options); } /**