Skip to content

Commit f8ed285

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

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

daemon/http-tx-mgr.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,9 @@ 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+
859862
if (token) {
860863
token_header = g_strdup_printf ("Seafile-Repo-Token: %s", token);
861864
headers = curl_slist_append (headers, token_header);
@@ -978,6 +981,16 @@ http_post (CURL *curl, const char *url, const char *token,
978981
/* Disable the default "Expect: 100-continue" header */
979982
headers = curl_slist_append (headers, "Expect:");
980983

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

0 commit comments

Comments
 (0)