summaryrefslogtreecommitdiff
path: root/t/new/02header-callback.t
diff options
context:
space:
mode:
Diffstat (limited to 't/new/02header-callback.t')
-rw-r--r--t/new/02header-callback.t20
1 files changed, 20 insertions, 0 deletions
diff --git a/t/new/02header-callback.t b/t/new/02header-callback.t
new file mode 100644
index 0000000..497e2dd
--- /dev/null
+++ b/t/new/02header-callback.t
@@ -0,0 +1,20 @@
+use strict;
+use Test::More tests => 1;
+use WWW::Curl::Easy;
+
+my $header;
+
+sub header_callback {
+ my $chunk = shift;
+ $header .= $chunk;
+ return length $chunk;
+}
+
+SKIP: {
+ skip 'You need to set CURL_TEST_URL', 1 unless $ENV{CURL_TEST_URL};
+ my $curl = new WWW::Curl::Easy;
+ $curl->setopt( CURLOPT_URL, $ENV{CURL_TEST_URL} );
+ $curl->setopt( CURLOPT_HEADERFUNCTION, \&header_callback );
+ $curl->perform;
+ ok($header);
+}