diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/data/test1308 | 3 | ||||
-rw-r--r-- | tests/unit/unit1308.c | 17 |
2 files changed, 20 insertions, 0 deletions
diff --git a/tests/data/test1308 b/tests/data/test1308 index fe7509688..88e9771dd 100644 --- a/tests/data/test1308 +++ b/tests/data/test1308 @@ -23,6 +23,9 @@ formpost unit tests <tool> unit1308 </tool> +<file name="log/test-1308"> +Piece of the file that is to uploaded as a formpost +</file> </client> </testcase> diff --git a/tests/unit/unit1308.c b/tests/unit/unit1308.c index 6b2ab0da6..80e6c57b0 100644 --- a/tests/unit/unit1308.c +++ b/tests/unit/unit1308.c @@ -75,4 +75,21 @@ UNITTEST_START curl_formfree(post); + /* start a new formpost with a file upload and formget */ + post = last = NULL; + + rc = curl_formadd(&post, &last, + CURLFORM_PTRNAME, "name of file field", + CURLFORM_FILE, "log/test-1308", + CURLFORM_FILENAME, "custom named file", + CURLFORM_END); + + fail_unless(rc == 0, "curl_formadd returned error"); + + rc = curl_formget(post, &total_size, print_httppost_callback); + fail_unless(rc == 0, "curl_formget returned error"); + fail_unless(total_size == 847, "curl_formget got wrong size back"); + + curl_formfree(post); + UNITTEST_STOP |