### ----------------------------------------------------
### -- HTTP::UserAgent
### -- Licenses: MIT
### -- Authors: Filip Sergot
### -- File: t/250-issue-144.rakutest
### ----------------------------------------------------
use HTTP::UserAgent;
use Test::Util::ServerPort;

use Test;

plan 1;

my $port = get-unused-port();

# Start a really bad server that just closes the connection
# without sending anything.
my $p = start {
    react {
        whenever IO::Socket::Async.listen('localhost', $port) -> $conn {
            $conn.close;
        }
    }

}

%*ENV<NO_PROXY> = 'localhost';

my $ua = HTTP::UserAgent.new;

my $res;

todo 'Windows OS error messages are localized' if $*DISTRO.is-win;
throws-like { $res = $ua.get("http://localhost:$port/") }, X::HTTP::Internal, rc => 500, "throws the correct exception";

# vim: expandtab shiftwidth=4


