Skip to content

Commit

Permalink
Use plack.request environment instead of private Requset methods
Browse files Browse the repository at this point in the history
Also set the minimum Plack version to the one which introduced them
  • Loading branch information
bbrtj committed Jun 20, 2024
1 parent bb113a8 commit 195b7e2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cpanfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
requires 'Plack' => '0';
requires 'Plack' => '1.0041';
requires 'Log::Dispatch' => '0';
requires 'JSON::MaybeXS' => '0';
requires 'Path::Tiny' => '0';
Expand Down
13 changes: 9 additions & 4 deletions lib/Kelp/Request.pm
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,26 @@ attr route_name => sub { undef };

attr query_parameters => sub {
my $self = shift;
my $raw = $self->_charset_decode_array($self->_query_parameters);

$self->SUPER::query_parameters;
my $raw = $self->_charset_decode_array($self->env->{'plack.request.query_parameters'});
return Hash::MultiValue->new(@{$raw});
};

attr body_parameters => sub {
my $self = shift;
my $raw = $self->_charset_decode_array($self->_body_parameters);

$self->SUPER::body_parameters;
my $raw = $self->_charset_decode_array($self->env->{'plack.request.body_parameters'});
return Hash::MultiValue->new(@{$raw});
};

attr parameters => sub {
my $self = shift;

my $raw_query = $self->_charset_decode_array($self->_query_parameters);
my $raw_body = $self->_charset_decode_array($self->_body_parameters);
$self->SUPER::parameters;
my $raw_query = $self->_charset_decode_array($self->env->{'plack.request.query_parameters'});
my $raw_body = $self->_charset_decode_array($self->env->{'plack.request.body_parameters'});
return Hash::MultiValue->new(@{$raw_query}, @{$raw_body});
};

Expand Down

0 comments on commit 195b7e2

Please sign in to comment.