Allow PseudoRequest to handle 0 and '' correctly. Kudos to knowmad for pointing this behavior out.

This commit is contained in:
Colin Kuskie 2011-09-29 14:39:52 -07:00
parent f33c19d503
commit c17d9aa394
2 changed files with 3 additions and 3 deletions

View file

@ -432,10 +432,10 @@ my $expected = {
},
'description' => undef,
'_isValid' => 1,
'deleteCreatedItems' => undef,
'deleteCreatedItems' => 0,
'canSubmitGroupId' => '2',
'assetId' => 'new',
'url' => undef,
'url' => '',
'daysBeforeCleanup' => '7',
'title' => 'Untitled',
} ;

View file

@ -87,7 +87,7 @@ sub body {
return keys %{ $self->{body} } if wantarray;
return { %{ $self->{body} } };
}
if ($self->{body}->{$value}) {
if (defined $self->{body}->{$value}) {
if (wantarray && ref $self->{body}->{$value} eq "ARRAY") {
return @{$self->{body}->{$value}};
}