Skip to content

Instantly share code, notes, and snippets.

@aereal
Created Jun 6, 2017
Embed
What would you like to do?
#!/usr/bin/env perl
use strict;
use warnings;
use HTTP::Message::PSGI qw(req_to_psgi);
use HTTP::Request;
use Plack::Request;
use Test::More;
use URI;
my $req = HTTP::Request->new(
'GET',
URI->new('http://example.com/'),
[
'Host' => 'another.example.com',
],
);
is $req->uri->host, 'example.com';
my $psgi_req = Plack::Request->new(req_to_psgi($req));
is $psgi_req->uri->host, 'example.com'; # !!!
done_testing;
@aereal
Copy link
Author

aereal commented Jun 6, 2017

req.t .............................. 
ok 1
not ok 2
#   Failed test at req.t line 24.
#          got: 'another.example.com'
#     expected: 'example.com'
1..2
# Looks like you failed 1 test of 2.
#FAIL ---
#

@aereal
Copy link
Author

aereal commented Jun 6, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment