Le 25/02/2013 09:59, Marius Olsthoorn a écrit :
You can set the (de)serializer to use in the configuration. For example:

     package Foo::Controller::Bar;

     __PACKAGE__->config(
         'default'   => 'application/json',
         'stash_key' => 'rest',
         'map'       => {
             'text/html'             => 'JSON',
             'application/jsonl'  => 'JSON',
         }
     );

I have mapped test/html to JSON here so it will work in the browser.

Seel also:
http://search.cpan.org/~bobtfish/Catalyst-Action-REST-1.06/lib/Catalyst/Action/Serialize.pm#CONFIGURATION

Marius

On 25 February 2013 08:13, Jean-Marc Choulet <[email protected]> wrote:
Hello,

I'm new to Catalyst and I've certainly a stupid question... I use a
Catalyst::Controller::REST to implement a web service. My question is : How
can I force a application/json content-type response when I ask my ws with
FF or Chrome... ?

Thanks

Jean-Marc

_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/
Hello Marius,

Great ! That works :)

Thanks you,

Jean-Marc

_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to