Skip to content

Commit

Permalink
Change toJson method (#48)
Browse files Browse the repository at this point in the history
add HTTP `application/json` header to the response which is generated by `toJson`
  • Loading branch information
parsagholipour committed Jan 28, 2021
1 parent 5082b1e commit bf83415
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/RedirectionForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Shetabit\Multipay;

use JsonSerializable;
use Illuminate\Support\Facades\Response;

class RedirectionForm implements JsonSerializable
{
Expand Down Expand Up @@ -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);
}

/**
Expand Down

0 comments on commit bf83415

Please sign in to comment.