summaryrefslogtreecommitdiff
path: root/t/new/06http-post.t
diff options
context:
space:
mode:
Diffstat (limited to 't/new/06http-post.t')
-rw-r--r--t/new/06http-post.t26
1 files changed, 26 insertions, 0 deletions
diff --git a/t/new/06http-post.t b/t/new/06http-post.t
new file mode 100644
index 0000000..55990f2
--- /dev/null
+++ b/t/new/06http-post.t
@@ -0,0 +1,26 @@
+use strict;
+use Test::More tests => 1;
+use WWW::Curl::Easy;
+
+my $max = 1000;
+
+sub read_callback {
+ my ( $maxlen, $sv ) = @_;
+
+ # Create some random data
+ my $data = chr( ord('A') + rand(26) ) x ( int( $max / 3 ) + 1 );
+ $max = $max - length $data;
+ return $data;
+}
+
+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_READFUNCTION, \&read_callback );
+ $curl->setopt( CURLOPT_INFILESIZE, $max );
+ $curl->setopt( CURLOPT_UPLOAD, 1 );
+ $curl->setopt( CURLOPT_CUSTOMREQUEST, 'POST' );
+ my $code = $curl->perform;
+ ok( $code == 0 );
+}