LWP-ConsoleLogger
view release on metacpan or search on metacpan
lib/LWP/ConsoleLogger/Easy.pm view on Meta::CPAN
my $args = shift;
$args ||= {};
my $headers = HTTP::Headers->new;
# HTTP::Tiny merges default_headers first, then per-request headers, with
# the per-request value winning (last-wins) rather than being appended.
# Merge both sources into one hash so a duplicated name produces a single
# overriding row, then copy once. Header names are compared
# case-insensitively (as HTTP::Tiny and HTTP::Headers both treat them) so
# that e.g. a default "Content-Type" and a per-request "content-type"
# collapse to one value instead of two appended rows. Arrayref values (a
# single header carrying multiple values) are preserved.
my %merged; # lc name => [ display name => value ]
foreach my $source ( $self->default_headers, $args->{headers} ) {
next unless $source;
$merged{ lc $_ } = [ $_ => $source->{$_} ] for keys %{$source};
}
my %clean = map { @{$_} } values %merged;
_copy_headers( $headers, \%clean );
t/test-data/unicode.html view on Meta::CPAN
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>
<body>
ð
</body>
</html>
( run in 1.112 second using v1.01-cache-2.11-cpan-99fa8243a42 )