Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
static size_t append_writer(void *arg, const char *buf, size_t len){ char *buffer = arg; char *ptr = buffer + strlen(buffer); strcpy(ptr, buf); return len; } static void test_form_write_content_type(){ char data[1024] = {0}; const char *content_text = NULL; struct curl_httppost *post=NULL, *last=NULL; char name[] = "name"; size_t name_len = sizeof(name) - 1; char cont[] = "data"; size_t cont_len = sizeof(cont) - 1; CURLcode code = curl_formadd(&post, &last, CURLFORM_PTRNAME, name, CURLFORM_NAMELENGTH, (long)name_len, CURLFORM_PTRCONTENTS, cont, LCURL_FORM_CONTENTLEN, (LCURL_LEN_TYPE)cont_len, CURLFORM_CONTENTTYPE, "text/plain", CURLFORM_END); code = curl_formget(post, data, append_writer); content_text = strstr(data, "text/plain"); // libcurl < 7.56.0 Has Content-Type: text/plain // libcurl 7.56.0 does not have Content-Type: text/plain }
I think curl should add content type if user ask to add it. Also I got same result if using slist with like
headers = curl_slist_append(headers, "Content-Type: text/plain"); curl_formadd(&post, &last, CURLFORM_CONTENTHEADER, headers, ...
libcurl 7.56.0
The text was updated successfully, but these errors were encountered:
text/plain
Found the problem: text/plain is the default and mime removes it as not needed. However it should be kept if explicitly set by the caller. I've assigned myself.
Sorry, something went wrong.
Maybe convert the recipe to a test case too while you're working on a fix!
0401734
Fixed by 0401734 @moteus: does it satisfy your needs ?
monnerat
No branches or pull requests
I did this
I expected the following
I think curl should add content type if user ask to add it.
Also I got same result if using slist with like
curl/libcurl version
libcurl 7.56.0
operating system
The text was updated successfully, but these errors were encountered: