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.
IE.
dispatch_get('/',function() {
switch(content_type()) {
case 'json':
echo json(array());
break;
default:
echo html('<div></div>');
break;
}
});
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
-
xangelo (at gmail) April 4th, 2011 @ 10:49 PM
Sorry, ignore this. Feature is present in request_method() and $_SERVER['REQUEST_METHOD']
-
Fabrice Luraine May 26th, 2011 @ 07:52 PM
- State changed from new to invalid
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.
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.