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

Documented the default values of Accept headers#9292

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

Merged
javiereguiluz merged 1 commit intosymfony:masterfromjaviereguiluz:fix_9290
Feb 20, 2018
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletioncomponents/http_foundation.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -269,6 +269,19 @@ If you need to get full access to parsed data from ``Accept``, ``Accept-Language
$accepts = AcceptHeader::fromString($request->headers->get('Accept'))
->all();

The default values that can be optionally included in the ``Accept-*`` headers
are also supported::

$acceptHeader = 'text/plain;q=0.5, text/html, text/*;q=0.8, */*;q=0.3';
$accept = AcceptHeader::fromString($acceptHeader);

$quality = $accept->get('text/xml')->getQuality(); // $quality = 0.8
$quality = $accept->get('application/xml')->getQuality(); // $quality = 0.3

.. versionadded:: 4.1
The support of default values in the ``Accept-*`` headers was introduced in
Symfony 4.1.

Accessing other Data
~~~~~~~~~~~~~~~~~~~~

Expand DownExpand Up@@ -403,7 +416,7 @@ of methods to manipulate the HTTP headers related to the cache:
.. note::

The methods :method:`Symfony\\Component\\HttpFoundation\\Response::setExpires`,
:method:`Symfony\\Component\\HttpFoundation\\Response::setLastModified` and
:method:`Symfony\\Component\\HttpFoundation\\Response::setLastModified` and
:method:`Symfony\\Component\\HttpFoundation\\Response::setDate` accept any
object that implements ``\DateTimeInterface``, including immutable date objects.

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp