[Catalyst] Catalyst::View::JSON sends a file
toby.corkindale at strategicdata.com.au
Tue Jan 12 04:18:15 GMT 2010
Tomas Doran wrote:
> On 11 Jan 2010, at 23:29, Christoph Friedrich wrote:
>> just worked a little with Catalyst::View::JSON. But when I call some
>> action via Firefox that uses this View Firefox gives me a file to
>> download and don't show the json directly.
>> Is there a way to change this behavior? I want to see what I would get
>> as JSON and not download it ^^
> Your browser will do whatever it normally does with the mime type you're
> By changing settings or mime types you'll probably be able to convince
> it to display the JSON.
You could also adjust the $c->response->content_type() to be 'text/plain'.
response based on it's content-type, and will not JSON-decode what it
thinks is html or plain text.
> However, why not write a JSON debug view that pretty prints JSON
> responses inside an HTML page?
Definitely the better option.
worth having that skill.
More information about the Catalyst