Skip to content

Instantly share code, notes, and snippets.

@aereal
Created June 6, 2017 09:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aereal/52cc757bea2cf2be1a1514751a6d3251 to your computer and use it in GitHub Desktop.
Save aereal/52cc757bea2cf2be1a1514751a6d3251 to your computer and use it in GitHub Desktop.
#!/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