Quick solution <if anybody still needed on sending json for runmode>
sub send_json_data: Runmode {
my $self = shift;
$self->header_add(-type=>"application/json");
...
}
OR
refer this inside of CGI::Application::Plugin::JSON
import() >> _send_headers() should take care of it..
though, its not taking care of for above runmode to return json data.
sub _send_headers {
my $self = shift;
my $private = $self->param('__CAP_JSON') || {};
if( defined $private->{header} ) {
$self->header_add( '-x-json' => $self->json_header_string );
}
if( defined $private->{json_body} ) {
$self->header_add('-type' => 'application/json');
} elsif ( defined $private->{json_callback} ) {
$self->header_add('-type' => 'text/javascript');
}
}
|