Proper way to use Accept header in a REST api made with Symfony2 and FOSRestBundle Proper way to use Accept header in a REST api made with Symfony2 and FOSRestBundle symfony symfony

Proper way to use Accept header in a REST api made with Symfony2 and FOSRestBundle


I was able to do what I wanted with this:

fos_rest:    format_listener:        rules:            - priorities: [ json, xml, html ]            - prefer_extension: false    routing_loader:        default_format: json    view:        view_response_listener: 'force'        formats:            json: true            xml: true        templating_formats:            html: true    serializer:        serialize_null: true

For some reason just having the prefer_extension config in format_listener is not enough.