Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FrameworkBundle] Add support for setting headers with TemplateContoller #19911

Merged
merged 1 commit into from
May 23, 2024

Conversation

Timherlaud
Copy link
Contributor

@Timherlaud Timherlaud commented May 22, 2024

fixes #19909

Copy link
Contributor

@alamirault alamirault left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution.

I left some comments

(I didn't see your PR before do it one my side 🙈 , you can take inspiration of mine 7.1...alamirault:symfony-docs:feature/19909-headers-template-controller)

templates.rst Outdated
Comment on lines 708 to 711
# add headers in response
headers:
Content-Type: 'image/svg+xml'
foo: 'bar'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# add headers in response
headers:
Content-Type: 'image/svg+xml'
foo: 'bar'
# optionally you can define HTTP headers to add to the response
headers:
Content-Type: 'text/html'
foo: 'bar'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

headers:
Content-Type: 'image/svg+xml'
foo: 'bar'

.. code-block:: xml

<!-- config/routes.xml -->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also update xml and php examples ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done :)

headers:
Content-Type: 'image/svg+xml'
foo: 'bar'

.. code-block:: xml

<!-- config/routes.xml -->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Foreach new feature, we add directive versionadded to tell is new. You can add it above Checking if a Template Exists title

.. versionadded:: 7.2

    The ``headers`` option was introduced in Symfony 7.2.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good information 👍

@Timherlaud
Copy link
Contributor Author

@alamirault thanks for your help, very good work, happy to see how to do a good PR

@OskarStark
Copy link
Contributor

Thank you Tim.

@OskarStark OskarStark merged commit 84c3c45 into symfony:7.2 May 23, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants