New in Symfony 4.2: Acceptable Request Formats

Warning: This post is about an unsupported Symfony version. Some of this information may be out of date. Read the most recent Symfony Docs.

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

Help the Symfony project!

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.


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

Comments are closed.

To ensure that comments stay relevant, they are closed for old posts.