#51 ✓invalid
xangelo (at gmail)

Content-type header

Reported by xangelo (at gmail) | March 31st, 2011 @ 06:12 PM

It would be nice to provide a complete RESTful compliant application using limonade-php by utilizing the Content-type in the request header to figure out what kind of view should be outputted.


dispatch_get('/',function() {

switch(content_type()) {
    case 'json':
        echo json(array()); 
        echo html('<div></div>');



Please ignore my first comment on this.

It turns out this is not feasible due to cross-browser inconsistencies with the http accept headers. I tried implementing this while respecting the q values of the headers, but it becomes impossible when IE and webkit are involved due to their ridiculous headers. (IE accepts application/msword over text/html).

Please delete this.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Limonade is a PHP micro-framework.

People watching this ticket