[Catalyst] Converting a GET request to a POST request

Ronald J Kimball rkimball at pangeamedia.com
Mon Nov 22 18:28:49 GMT 2010


On Mon, Nov 22, 2010 at 12:53 PM, Tomas Doran <bobtfish at bobtfish.net> wrote:
>
> On 22 Nov 2010, at 17:44, Ronald J Kimball wrote:
>>
>> This works for JSON requests (e.g. application/json), but not for
>> JSONP requests (e.g. text/javascript), because there is no
>> Catalyst::Action::Deserialize::JSONP.  I guess I could create one that
>> extends Catalyst::Action::Deserialize::JSON...
>
> Yes, that's a more correct solution.
> http://cpansearch.perl.org/src/BOBTFISH/Catalyst-Action-REST-0.87/lib/Catalyst/Action/Deserialize/JSON.pm
> Catalyst::Action::Deserialize::JSON reads out of the body (but it doesn't
> care what the request method is - you can PUT instead of POST for example).
> So do that, and you have no more issues?

It doesn't care what the request method is, as long as it's POST, PUT,
OPTIONS, or DELETE.  ;)

If I create Catalyst::Action::Deserialize::JSONP, I'll still need to
convert the GET request to a POST.  That seems to be the really tricky
part.

Ronald



More information about the Catalyst mailing list