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().

Comments

Which would be the equivalent for '*/*' ???
Formats are defined in one internationnaly norm ?
Since the code is :

/**
* 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('*/*'),
Thanks for the feedbacks. This has been reverted in https://github.com/symfony/symfony/pull/29047
Login with SymfonyConnect to post a comment