On Mon, Nov 22, 2010 at 7:33 PM, Tomas Doran <bobtf...@bobtfish.net> wrote:
>
> On 22 Nov 2010, at 18:28, Ronald J Kimball wrote:
>>
>> It doesn't care what the request method is, as long as it's POST, PUT,
>> OPTIONS, or DELETE.  ;)
>
> No, it just doesn't care.
>
>> 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.
>
> Why? Where is the code which forces it to be a POST?

In Catalyst::Action::Deserialize:

sub execute {
    my $self = shift;
    my ( $controller, $c ) = @_;

    my @demethods = qw(POST PUT OPTIONS DELETE);
    my $method    = $c->request->method;
    if ( grep /^$method$/, @demethods ) {
        my ( $sclass, $sarg, $content_type ) =
          $self->_load_content_plugins( 'Catalyst::Action::Deserialize',
            $controller, $c );
        return 1 unless defined($sclass);
        my $rc;
        if ( defined($sarg) ) {
            $rc = $sclass->execute( $controller, $c, $sarg );
        } else {
            $rc = $sclass->execute( $controller, $c );
        }
        if ( $rc eq "0" ) {
            return $self->_unsupported_media_type( $c, $content_type );
        } elsif ( $rc ne "1" ) {
            return $self->_serialize_bad_request( $c, $content_type, $rc );
        }
    }

    $self->maybe::next::method(@_);

    return 1;
}


Ronald

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

Reply via email to