[Catalyst] Overriding content-type for View::JSON

will trillich will.trillich at serensoft.com
Mon Dec 19 15:40:00 GMT 2011


Short version: what's the protocol in a MyApp::View::Blah to override
content-type in certain circumstances?

Long version:

We're trying to get the blueimp file-upload jQuery library working under IE
(fine under firefox and chrome, of course):
https://github.com/blueimp/jQuery-File-Upload/wiki/Setup

The recommendation is that the server should set content-type to text/html
or text/plain instead of application/json for IE. Here's the PHP example
they post:

<?php
header('Vary: Accept');
if (isset($_SERVER['HTTP_ACCEPT']) &&
    (strpos($_SERVER['HTTP_ACCEPT'], 'application/json') !=3D=3D false)) {
    header('Content-type: application/json');
} else {
    header('Content-type: text/plain');
}
?>

What's required in MyApp::View::JSON to handle this properly?


-- =

"We act as though comfort and luxury were the chief requirements of life,
when all that we need to make us happy is something to be enthusiastic
about." -- Albert Einstein
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20111219/f6f78=
33c/attachment.htm


More information about the Catalyst mailing list