5

although the headers attribute are public.

1 Answer 1

14

Because they are public. Just access them through the property directly:

$request->headers->get('Content-Type');

The request header collection is an instance of Symfony\Component\HttpFoundation\HeaderBag, the response headers are contained in a Symfony\Component\HttpFoundation\ResponseHeaderBag.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.