#!/usr/bin/perl
use strict;
use warnings;
use FindBin;
use Test::More;
use Test::Fatal;
use Plack::Test;
use Plack::Util;
use HTTP::Request::Common;
BEGIN {
eval "use Path::Class;";
if ( $@ ) {
pass('Path::Class is required for this test');
done_testing;
exit;
}
}
my $dir = file(__FILE__)->parent->parent->parent->subdir('examples')->subdir('yapc-talk-examples');
test_psgi
Plack::Util::load_psgi( $dir->file('130-tracing-header.psgi')->stringify ),
sub {
my $cb = shift;
{
my $res = $cb->(GET "/" => ('Accept' => 'text/html'));
is($res->code, 200, '... got the expected status');
is($res->header('Content-Type'), 'text/html', '... got the expected Content-Type header');
is($res->header('Content-Length'), 46, '... got the expected Content-Length header');
is(
$res->header('X-Web-Machine-Trace'),
'b13,b12,b11,b10,b9,b8,b7,b6,b5,b4,b3,c3,c4,d4,e5,f6,g7,g8,h10,i12,l13,m16,n16,o16,o18,o18b',
'... got the tracing header we expected'
);
is(
$res->content,
'<html><body><h1>Hello World</h1></body></html>',
'... got the expected content'
);
}
};
done_testing;