Skip to content

Commit

Permalink
Update test and remove lingering keys in request
Browse files Browse the repository at this point in the history
  • Loading branch information
xsawyerx committed Apr 1, 2022
1 parent 2767a9c commit 2faca00
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
9 changes: 4 additions & 5 deletions lib/Dancer2/Core/App.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1593,12 +1593,11 @@ sub build_request {

# If we have an app, send the serialization engine
my $request = Dancer2::Core::Request->new(
env => $env,
is_behind_proxy => $self->settings->{'behind_proxy'} || 0,
env => $env,

$self->has_serializer_engine
? ( serializer => $self->serializer_engine )
: (),
$self->has_serializer_engine
? ( serializer => $self->serializer_engine )
: (),
);

return $request;
Expand Down
10 changes: 4 additions & 6 deletions lib/Dancer2/Core/Request.pm
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ our $XS_HTTP_COOKIES = eval { require_module('HTTP::XSCookies'); 1; };

our $_id = 0;

# self->new( env => {}, serializer => $s, is_behind_proxy => 0|1 )
# self->new( env => {}, serializer => $s )
sub new {
my ( $class, @args ) = @_;

Expand All @@ -65,9 +65,8 @@ sub new {
}

# additionally supported attributes
$self->{'id'} = ++$_id;
$self->{'vars'} = {};
$self->{'is_behind_proxy'} = !!$opts{'is_behind_proxy'};
$self->{'id'} = ++$_id;
$self->{'vars'} = {};

$opts{'body_params'}
and $self->{'_body_params'} = $opts{'body_params'};
Expand Down Expand Up @@ -566,8 +565,7 @@ sub _shallow_clone {
$new_request->{headers} = $self->headers;

# Copy remaining settings
$new_request->{is_behind_proxy} = $self->{is_behind_proxy};
$new_request->{vars} = $self->{vars};
$new_request->{vars} = $self->{vars};

# Clone any existing decoded & cached body params. (GH#1116 GH#1269)
$new_request->{'body_parameters'} = $self->body_parameters->clone;
Expand Down
2 changes: 1 addition & 1 deletion t/issues/gh-730.t
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use HTTP::Request::Common;
package App;
use Dancer2;

get '/' => sub { request->is_behind_proxy };
get '/' => sub { app->config->{'behind_proxy'} };
}

my $app = App->to_app;
Expand Down

0 comments on commit 2faca00

Please sign in to comment.