summaryrefslogtreecommitdiff
path: root/t/headers/attachment.t
diff options
context:
space:
mode:
Diffstat (limited to 't/headers/attachment.t')
-rw-r--r--t/headers/attachment.t23
1 files changed, 23 insertions, 0 deletions
diff --git a/t/headers/attachment.t b/t/headers/attachment.t
new file mode 100644
index 0000000..967e9b8
--- /dev/null
+++ b/t/headers/attachment.t
@@ -0,0 +1,23 @@
+use strict;
+use CGI;
+use Test::More;
+
+{
+ my $cgi = CGI->new;
+ my $got = $cgi->header( -attachment => 'foo.png' );
+ my $expected = 'Content-Disposition: attachment; filename="foo.png"'
+ . $CGI::CRLF
+ . 'Content-Type: text/html; charset=ISO-8859-1'
+ . $CGI::CRLF x 2;
+ is $got, $expected, 'attachment';
+}
+
+{
+ my $cgi = CGI->new;
+ my $got = $cgi->header( -attachment => q{} );
+ my $expected = "Content-Type: text/html; charset=ISO-8859-1"
+ . $CGI::CRLF x 2;
+ is $got, $expected, 'attachment empty string';
+}
+
+done_testing;