mark icon indicating copy to clipboard operation
mark copied to clipboard

How to change header Content-Type: text/html;charset=utf-8 to application/json

Open haidarvm opened this issue 4 years ago • 4 comments

For better handling in some programming we detect Header Content-type json, I did add header('Content-Type: application/json'); but still don't work

haidarvm avatar Aug 11 '20 18:08 haidarvm

For example. use Workerman/Protocols/Http/Response; // ..... return new Response(200, [“ Content-Type” => “ application/json”], json_encode($data));

passwalls avatar Aug 12 '20 03:08 passwalls

Ok, Great its work

use Workerman\Protocols\Http\Response; new Response(200, ["Content-Type" => "application/json"], json_encode($data));

but it's make performance little bit slower when I'm using wrk

haidarvm avatar Aug 12 '20 11:08 haidarvm