Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[TwigBundle] 'Content-Type' response header match the requested format when generating error pages#22548

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
damienflament wants to merge2 commits intosymfony:masterfromdamienflament:patch-1

Conversation

@damienflament
Copy link

@damienflamentdamienflament commentedApr 27, 2017
edited by nicolas-grekas
Loading

QA
Branch?master
Bug fix?no related issue found
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes/no
Fixed tickets-
LicenseMIT
Doc PR-

TheContent-Type response header needs to match the format of the generated response content.

This is obviously useful when an exception is thrown during an XMLHttpRequest handling using JSON content. Currently, the browser (Firefox Developer Edition) handles well the response content and show it as a JSON object. Maybe by looking the request content type or just by recognizing the response content type while parsing it. But the response type is shown ashtml. This PR fix it.

By using theRequest::getMimeType() method, we take care of the additional format added by the developer.

…t when generating error pages.The 'Content-Type' response header need to match the format of the generated response content.This is obviously useful when an exception is thrown during an XMLHttpRequest handling using JSON content. Currently, the browser (Firefox Developer Edition) handles well the response content and show it as a JSON object. Maybe by looking the request content type or just by recognizing the response content type while parsing it. But the response type is shown as _html_. This PR fix it.By using the _Request::getMimeType()_ method, we take care of the additional format added by the developer.
@damienflament
Copy link
Author

There is a test failure because I pass the exception status code to the created Response object instead of the default 200 HTTP status code. But returning a 200 HTTP status code seems unsuitable when showing an error.

@nicolas-grekasnicolas-grekas changed the title[TwigBundle] 'Content-Type' response header match the requested forma…[TwigBundle] 'Content-Type' response header match the requested format when generating error pagesApr 27, 2017
@xabbuhxabbuh added this to the2.7 milestoneMay 20, 2017
@fabpot
Copy link
Member

@damienflament Can you rebase this pull request?

@nicolas-grekas
Copy link
Member

Fixed in#23052

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

2.7

Development

Successfully merging this pull request may close these issues.

5 participants

@damienflament@fabpot@nicolas-grekas@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp