Return "setDefault" when key is undefined (Closes: #903)
This commit is contained in:
parent
6282810fcc
commit
4e0f37d071
|
@ -711,7 +711,8 @@ sub getKey {
|
|||
|
||||
# When "hash"
|
||||
if ( $key =~ qr/^$simpleHashKeys$/o ) {
|
||||
$value //= {};
|
||||
return $self->sendError( $req, 'setDefault', 200 )
|
||||
unless defined($value);
|
||||
|
||||
# If a hash key is asked return its value
|
||||
if ($subkey) {
|
||||
|
@ -736,6 +737,7 @@ sub getKey {
|
|||
# When scalar
|
||||
return $self->sendError( $req, "Key $key is not a hash", 400 )
|
||||
if ($subkey);
|
||||
return $self->sendError( $req, 'setDefault', 200 ) unless defined($value);
|
||||
return $self->sendJSONresponse( $req, { value => $value } );
|
||||
|
||||
# TODO authParam key
|
||||
|
|
|
@ -615,7 +615,7 @@
|
|||
}
|
||||
|
||||
var setHelp = function(scope) {
|
||||
if (!showH) return;
|
||||
if (!$scope.showH) return;
|
||||
while (!scope.$modelValue.help && scope.$parentNodeScope) {
|
||||
scope = scope.$parentNodeScope;
|
||||
}
|
||||
|
|
|
@ -62,13 +62,20 @@ while (<F>) {
|
|||
close F;
|
||||
|
||||
ok( $hstruct = from_json($hstruct), 'struct.json is JSON' );
|
||||
ok( ref $hstruct eq 'ARRAY', 'struct.json is an array' );
|
||||
ok( ref $hstruct eq 'ARRAY', 'struct.json is an array' )
|
||||
or print STDERR "Expected: ARRAY, got: " . ( ref $hstruct ) . "\n";
|
||||
count(2);
|
||||
|
||||
foreach my $query (@hkeys) {
|
||||
my $href = &client->jsonResponse( "/confs/1/$query", '' );
|
||||
ok( ref $href eq 'ARRAY', 'Response is an array' );
|
||||
ok(
|
||||
( ref $href eq 'ARRAY' )
|
||||
or
|
||||
( ( ref $href eq 'HASH' ) and ( $href->{error} =~ /setDefault$/ ) ),
|
||||
'Response is an array'
|
||||
);
|
||||
count(1);
|
||||
next if ( ( ref $href eq 'HASH' ) and ( $href->{error} =~ /setDefault$/ ) );
|
||||
foreach my $k (@$href) {
|
||||
ok( defined $k->{title}, 'Title defined' );
|
||||
ok( defined $k->{id}, 'Id defined' );
|
||||
|
|
Loading…
Reference in New Issue
Block a user