php - Check if the file in the response has the header Content-Type: application/json

Hello everyone i'm trying to figure out how to check the response has a header that i expect.
I have a json file that i'm returing and the response header should be application/json
How is this done best in symfony ?
$file = __DIR__ . '/../../' . '/myjson/jsonfile.json' ;
$json = json_decode(file_get_contents($file));
return new JsonResponse(
$json,
Response::HTTP_OK
);
I have tried setting the header forcefully, but it does not accomplish what i want
$response->headers->set('Content-Type', 'text/plain');
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: call to a member function getclientoriginalname() on null
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.