-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix RemoteConnection mishandling redirects
Due to f72178f in #164, the request sub in RemoteConnection no longer accepts a list of parameters. Instead, it wants a couple hashrefs, and we forgot to update the invocation in the response handler during the redirect case.
- Loading branch information
Showing
2 changed files
with
44 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#! /usr/bin/perl | ||
|
||
use strict; | ||
use warnings; | ||
use Test::More; | ||
use Test::Exception; | ||
use Test::LWP::UserAgent; | ||
|
||
BEGIN: { | ||
unless (use_ok('Selenium::Remote::RemoteConnection')) { | ||
BAIL_OUT("Couldn't load Selenium::Remote::RemoteConnection"); | ||
exit; | ||
} | ||
} | ||
|
||
REDIRECT: { | ||
my $tua = Test::LWP::UserAgent->new( | ||
max_redirect => 0 | ||
); | ||
|
||
$tua->map_response(qr/redirect/, HTTP::Response->new(303, undef, ['Location' => 'http://localhost/elsewhere'])); | ||
$tua->map_response(qr/elsewhere/, HTTP::Response->new(200, 'OK', undef, '')); | ||
|
||
my $conn = Selenium::Remote::RemoteConnection->new( | ||
remote_server_addr => 'localhost', | ||
port => '', | ||
ua => $tua | ||
); | ||
|
||
my $redirect_endpoint = { | ||
method => 'GET', | ||
url => 'http://localhost/redirect' | ||
}; | ||
|
||
lives_ok(sub { $conn->request($redirect_endpoint) }, '303 redirects no longer kill us'); | ||
} | ||
|
||
|
||
done_testing; |
2a0c9b3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for appium/perl-client#5