diff --git a/Koha/REST/Plugin/Query.pm b/Koha/REST/Plugin/Query.pm index 56f2e2b0f1..5ce0da42f3 100644 --- a/Koha/REST/Plugin/Query.pm +++ b/Koha/REST/Plugin/Query.pm @@ -364,7 +364,7 @@ sub _parse_embed { $result->{$curr} = { children => _parse_embed( $next ) }; } else { - if ( $curr =~ m/^(?.*)\+count/ ) { + if ( $curr =~ m/^(?.*)[\+|:]count/ ) { my $key = $+{relation} . "_count"; $result->{$key} = { is_count => 1 }; } diff --git a/t/Koha/REST/Plugin/Query.t b/t/Koha/REST/Plugin/Query.t index 9da2590e48..46493987f4 100755 --- a/t/Koha/REST/Plugin/Query.t +++ b/t/Koha/REST/Plugin/Query.t @@ -433,7 +433,7 @@ subtest '_build_query_params_from_api' => sub { subtest 'stash_embed() tests' => sub { - plan tests => 14; + plan tests => 16; my $t = Test::Mojo->new; @@ -446,6 +446,9 @@ subtest 'stash_embed() tests' => sub { $t->get_ok( '/stash_embed' => { 'x-koha-embed' => 'holds+count' } ) ->json_is( '/embed' => { holds_count => { is_count => 1 } } ); + $t->get_ok( '/stash_embed' => { 'x-koha-embed' => 'holds:count' } ) + ->json_is( '/embed' => { holds_count => { is_count => 1 } } ); + $t->get_ok( '/stash_embed' => { 'x-koha-embed' => 'checkouts,checkouts.item,patron' } ) ->json_is( '/embed' => { checkouts => { children => { item => {} } },