Skip to content

Commit 3dc8254

Browse files
committed
add Content-Type header
1 parent 0fdc14d commit 3dc8254

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

daemon/http-tx-mgr.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,10 @@ http_put (CURL *curl, const char *url, const char *token,
856856
/* Disable the default "Expect: 100-continue" header */
857857
headers = curl_slist_append (headers, "Expect:");
858858

859+
if (req_content) {
860+
headers = curl_slist_append (headers, "Content-Type: application/octet-stream");
861+
}
862+
859863
if (token) {
860864
token_header = g_strdup_printf ("Seafile-Repo-Token: %s", token);
861865
headers = curl_slist_append (headers, token_header);
@@ -978,6 +982,16 @@ http_post (CURL *curl, const char *url, const char *token,
978982
/* Disable the default "Expect: 100-continue" header */
979983
headers = curl_slist_append (headers, "Expect:");
980984

985+
if (req_content) {
986+
json_t *is_json = NULL;
987+
is_json = json_loads (req_content, 0, NULL);
988+
if (is_json)
989+
headers = curl_slist_append (headers, "Content-Type: application/json");
990+
else
991+
headers = curl_slist_append (headers, "Content-Type: application/octet-stream");
992+
json_decref (is_json);
993+
}
994+
981995
if (token) {
982996
token_header = g_strdup_printf ("Seafile-Repo-Token: %s", token);
983997
headers = curl_slist_append (headers, token_header);

0 commit comments

Comments
 (0)