diff options
author | Patrick Monnerat <patrick@monnerat.net> | 2017-10-12 19:36:16 +0100 |
---|---|---|
committer | Patrick Monnerat <patrick@monnerat.net> | 2017-10-12 19:36:16 +0100 |
commit | 0401734dfd39617a42318295a6e54064b40b2502 (patch) | |
tree | 823fce7c271e1a8ee7447260b9c690050f0c5c9e /tests/libtest | |
parent | 56509055d23986479f472d667625426f51074992 (diff) |
mime: keep "text/plain" content type if user-specified.
Include test cases in 554, 587, 650.
Fixes https://github.com/curl/curl/issues/1986
Diffstat (limited to 'tests/libtest')
-rw-r--r-- | tests/libtest/lib554.c | 9 | ||||
-rw-r--r-- | tests/libtest/lib650.c | 15 |
2 files changed, 13 insertions, 11 deletions
diff --git a/tests/libtest/lib554.c b/tests/libtest/lib554.c index 936d0a10a..cc21d245b 100644 --- a/tests/libtest/lib554.c +++ b/tests/libtest/lib554.c @@ -117,7 +117,7 @@ static int once(char *URL, bool oldstyle) CURLFORM_END); if(formrc) - printf("curl_formadd(1) = %d\n", (int)formrc); + printf("curl_formadd(2) = %d\n", (int)formrc); /* Fill in the filename field */ formrc = curl_formadd(&formpost, @@ -134,7 +134,7 @@ static int once(char *URL, bool oldstyle) CURLFORM_END); if(formrc) - printf("curl_formadd(2) = %d\n", (int)formrc); + printf("curl_formadd(3) = %d\n", (int)formrc); /* Fill in a submit field too */ formrc = curl_formadd(&formpost, @@ -147,10 +147,11 @@ static int once(char *URL, bool oldstyle) #else CURLFORM_COPYCONTENTS, "send", #endif + CURLFORM_CONTENTTYPE, "text/plain", CURLFORM_END); if(formrc) - printf("curl_formadd(3) = %d\n", (int)formrc); + printf("curl_formadd(4) = %d\n", (int)formrc); formrc = curl_formadd(&formpost, &lastptr, CURLFORM_COPYNAME, "somename", @@ -160,7 +161,7 @@ static int once(char *URL, bool oldstyle) CURLFORM_END); if(formrc) - printf("curl_formadd(4) = %d\n", (int)formrc); + printf("curl_formadd(5) = %d\n", (int)formrc); curl = curl_easy_init(); if(!curl) { diff --git a/tests/libtest/lib650.c b/tests/libtest/lib650.c index 130ef1e77..60a2e9f1d 100644 --- a/tests/libtest/lib650.c +++ b/tests/libtest/lib650.c @@ -68,10 +68,14 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - /* Check proper name and data copying. */ + /* Check proper name and data copying, as well as headers. */ + headers = curl_slist_append(headers, "X-customheader-1: Header 1 data"); + headers = curl_slist_append(headers, "X-customheader-2: Header 2 data"); + headers = curl_slist_append(headers, "Content-Type: text/plain"); formrc = curl_formadd(&formpost, &lastptr, CURLFORM_COPYNAME, &name, CURLFORM_COPYCONTENTS, &data, + CURLFORM_CONTENTHEADER, headers, CURLFORM_END); if(formrc) @@ -113,18 +117,15 @@ int test(char *URL) if(formrc) printf("curl_formadd(3) = %d\n", (int) formrc); - /* Check data from file content and headers. */ - headers = curl_slist_append(headers, "X-customheader-1: Header 1 data"); - headers = curl_slist_append(headers, "X-customheader-2: Header 2 data"); + /* Check data from file content. */ formrc = curl_formadd(&formpost, &lastptr, CURLFORM_COPYNAME, "filecontents", CURLFORM_FILECONTENT, libtest_arg2, - CURLFORM_CONTENTHEADER, headers, CURLFORM_END); if(formrc) - printf("curl_formadd(3) = %d\n", (int) formrc); + printf("curl_formadd(4) = %d\n", (int) formrc); /* Measure the current form length. * This is done before including stdin data because we want to reuse it @@ -148,7 +149,7 @@ int test(char *URL) CURLFORM_END); if(formrc) - printf("curl_formadd(4) = %d\n", (int) formrc); + printf("curl_formadd(5) = %d\n", (int) formrc); curl = curl_easy_init(); if(!curl) { |