I am calling a function which is in my laravel controller. I have used laravel's custom response to return data. But some other data is getting added to my response even though I have not added it.
return Response::make(json_encode(array(
'error' => false,
'message' => 'Redaction done successfully.',
'is_redacted' => 0)), 200,
array(
'Content-Type' => 'application/json'
)
);
Above is the code that I have added to return my response. But response that I am receiving is:
> * Found bundle for host redaction-stage-tcm.tylerhost.net: 0x55998c67ee40
* Re-using existing connection! (#0) with host redaction-stage-tcm.tylerhost.net
* Connected to redaction-stage-tcm.tylerhost.net (208.64.239.110) port 443 (#0)
> POST /ocr/OCRWeb/v2/Documents('mfr_8')/OCRWeb.Scan HTTP/1.1
Host: redaction-stage-tcm.tylerhost.net
User-Agent: GuzzleHttp/6.3.3 curl/7.43.0 PHP/5.6.11-1ubuntu3.4
OData-Version: 4.01
OData-MaxVersion: 4.01
Content-Type: application/json
Content-Length: 2
upload completely sent off: 2 out of 2 bytes
< HTTP/1.1 200
< Cache-Control: no-transform
< Cache-Control: no-cache
< Cache-Control: no-store
< Cache-Control: must-revalidate
< Cache-Control: max-age=0
< Expires: Thu, 01 Jan 1970 00:00:00 GMT
< Vary: *
< Pragma: no-cache
< X-Clacks-Overhead: GNU Terry Pratchett
< OData-Version: 4.01
< Preference-Applied:
< Content-Type: application/json; odata.metadata=minimal
< Content-Length: 163
< Date: Wed, 13 Feb 2019 10:44:40 GMT
<
* Connection #0 to host redaction-stage-tcm.tylerhost.net left intact
{"error":false,"message":"Redaction done successfully.","is_redacted":0}
I have called some rest APIs in my function. This data is related to that but why is it getting appended to my custom response?? Please help me with it.
答案 0 :(得分:0)
尝试一下
return response()->json([
'error' => false,
'message' => 'Redaction done successfully.',
'is_redacted' => 0,
'Content-Type' => 'application/json'
], 200)