Unverified Commit 7b4a411c authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

DBRIS: Use optional proxy for map (journey) requests

parent f830f5d4
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@ use Encode qw(decode encode);
use Travel::Status::DE::DBRIS;
use Mojo::JSON qw(decode_json);
use Mojo::Promise;
use Mojo::UserAgent;

sub new {
	my ( $class, %opt ) = @_;
@@ -38,6 +39,13 @@ sub get_polyline_p {

	my $agent = $self->{user_agent};

	if ( my $proxy = $ENV{DBFAKEDISPLAY_DBRIS_PROXY} ) {
		say "set up proxy $proxy";
		$agent = Mojo::UserAgent->new;
		$agent->proxy->http($proxy);
		$agent->proxy->https($proxy);
	}

	Travel::Status::DE::DBRIS->new_p(
		journey       => $trip_id,
		with_polyline => 1,