From ee71a472fdc5cea219a89daaeddad3eb280bc3cf Mon Sep 17 00:00:00 2001 From: Ankit Pati Date: Tue, 16 Jul 2019 20:45:27 +0530 Subject: [PATCH 1/2] CSP Hashes for Embedded ` + + + + Hello, World! + + +EOS + }, + { + description => 'multiple + + + Hello, World! + + + + + +EOS + }, + { + description => 'multiple + + + Hello, World! + + + + + +EOS + }, + { + description => 'multiple + + + + Hello, World! + + + + + + + + +EOS + }, + { + description => 'unknown hash algorithm (no hash calculated)', + config => { + do_csp => 'unknown435', + }, + csp => { + 'script-src' => [qw( + )], + 'style-src' => [qw( + )], + }, + html => <<'EOS', + + + Hello! + + + + + Hello, World! + + +EOS + }, +); + +foreach my $test ( @tests ) { + my $packer = HTML::Packer->init; + + my $html = $test->{html}; + $packer->minify( \$html, $test->{config} ); + + is_deeply( { $packer->csp }, $test->{csp}, $test->{description} ); +}