Skip to content

Commit

Permalink
OpenSocialプラグインでbody_parametersとquery_parametersに同じキーがあった時にうまく動かなかったのを修正
Browse files Browse the repository at this point in the history
  • Loading branch information
Songmu committed Mar 17, 2012
1 parent b339bd1 commit 326f144
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion lib/Moxy/Plugin/OpenSocial.pm
Expand Up @@ -63,7 +63,20 @@ sub request_filter :Hook {
my $consumer_secret = $args->{session}->get('opensocial_consumer_secret');

if ($args->{session}->get('validate_post')) {
%param = (%{$self->_parse_request_body($req)}, %param);
my %body_param = %{$self->_parse_request_body($req)};
for my $key (keys %body_param) {
my $value = $body_param{$key};
if (exists $param{$key}) {
my @values = ref $value eq 'ARRAY' ? @$value : ($value);
my $v = $param{$key};
$v = [$v] unless ref $v eq 'ARRAY';
push @$v, @values;
$param{$key} = $v;
}
else {
$param{$key} = $value;
}
}
}

return unless $consumer_key && $consumer_secret;
Expand Down

0 comments on commit 326f144

Please sign in to comment.