Heya,

The sf2 routing seems nice and all but there is one feature I kinda miss
still (I think it's not possible at least), is the ability to set the
content type of the request based on headers instead of extensions.

So now you have:

hello:
  pattern:  /hello/:name.:_format
  defaults: { _bundle: HelloBundle, _controller: Hello, _action: index }
  requirements:
    _format: (json|html)

What I'd like to propose is to also have something like:

_formats:
  html:
    default: true
  json:
    headers:
      Accept: application/json

hello:
  pattern:  /hello/:name
  defaults: { _bundle: HelloBundle, _controller: Hello, _action: index }

Which would enable json on any route if you request the page with the
right Accept header.

Then if you request a route that doesn't handle json so be it the page
dies, it's not a bigger problem than a 404 error imo, since it shouldn't
happen in normal use cases of your web app.

Cheers,
Jordi

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to