New in Symfony 4.2: Acceptable Request Formats
This blog post explained a feature that was reverted before the release of
Symfony 4.2. That's why the original blog post content has been removed. You can
keep using the following Request
methods to work with request formats and
MIME types: getMimeType()
, getFormat()
, getRequestFormat()
,
getContentType()
and getAcceptableContentTypes()
.
As with any Open-Source project, contributing code or documentation is the most common way to help, but we also have a wide range of sponsoring opportunities.
New in Symfony 4.2: Acceptable Request Formats symfony.com/index.php/blog/new-in-symfony-4-2-acceptable-request-formats
Tweet thisComments
/**
* Initializes HTTP request formats.
*/
protected static function initializeFormats()
{
static::$formats = array(
'html' => array('text/html', 'application/xhtml+xml'),
'txt' => array('text/plain'),
'js' => array('application/javascript', 'application/x-javascript', 'text/javascript'),
'css' => array('text/css'),
'json' => array('application/json', 'application/x-json'),
'jsonld' => array('application/ld+json'),
'xml' => array('text/xml', 'application/xml', 'application/x-xml'),
'rdf' => array('application/rdf+xml'),
'atom' => array('application/atom+xml'),
'rss' => array('application/rss+xml'),
'form' => array('application/x-www-form-urlencoded'),
);
}
There's no format for */*.
You can maybe trye to add your own like :
'*' => array('*/*'),
Comments are closed.
To ensure that comments stay relevant, they are closed for old posts.
Randy Tellez Galan said on Oct 26, 2018 at 14:22 #1