if (ref $coderef) {
my @args = $app_msg->params;
+ $coderef->session( $session );
my $appreq = OpenSRF::AppRequest->new( $session );
$appreq->max_chunk_size( $coderef->max_chunk_size );
$appreq->max_chunk_count( $coderef->max_chunk_count );
($args{object_hint} = $args{package}) =~ s/::/_/go;
}
- OpenSRF::Utils::JSON->register_class_hint( name => $args{package}, hint => $args{object_hint}, type => "hash" );
+ OpenSRF::Utils::JSON->register_class_hint(
+ strip => ['session'],
+ name => $app,
+ hint => $args{object_hint},
+ type => "hash"
+ );
$_METHODS[$args{api_level}]{$args{api_name}} = bless \%args => $app;
$meth = $self->method_lookup($method,$proto,1);
}
+ $meth->session($self->session) if $meth && ref($self); # Pass the caller's session
return $meth;
}
if ( !UNIVERSAL::isa($req, 'OpenSRF::AppRequest') ) {
$log->debug("Creating a SubRequest object", DEBUG);
unshift @params, $req;
- $req = OpenSRF::AppSubrequest->new;
- $req->session( $self->session ) if ($self->session);
-
+ $req = OpenSRF::AppSubrequest->new( session => $self->session );
} else {
$log->debug("This is a top level request", DEBUG);
}
if(UNIVERSAL::isa($obj, 'HASH')) {
$jsonobj = {};
- $jsonobj->{$_} = $pkg->perl2JSONObject($obj->{$_}) for (keys %$obj);
+ for my $k (keys %$obj) {
+ next if (
+ $ref ne 'HASH'
+ and exists $_class_map{classes}{$ref}{strip}
+ and grep { $k eq $_ } @{$_class_map{classes}{$ref}{strip}}
+ );
+ $jsonobj->{$k} = $pkg->perl2JSONObject($obj->{$k});
+ }
} elsif(UNIVERSAL::isa($obj, 'ARRAY')) {
$jsonobj = [];
$jsonobj->[$_] = $pkg->perl2JSONObject($obj->[$_]) for(0..scalar(@$obj) - 1);