]> git.ipfire.org Git - people/ms/pakfire.git/commitdiff
xfer: Send the appropriate content type header is sending JSON
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 21 Jun 2025 16:51:09 +0000 (16:51 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 21 Jun 2025 16:51:09 +0000 (16:51 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/xfer.c

index 0c018e625fcf88b2a8c0e84c72662b725539fb08..ccd7ec87a4cfc3ab4ed8fb7f36c925993dad07a0 100644 (file)
@@ -708,6 +708,12 @@ int pakfire_xfer_set_payload(struct pakfire_xfer* self, const char* payload) {
 
 int pakfire_xfer_set_json_payload(struct pakfire_xfer* self, struct json_object* json) {
        const char* s = NULL;
+       int r;
+
+       // Set the Content-Type header
+       r = pakfire_xfer_add_header(self, "Content-Type: application/json");
+       if (r < 0)
+               return r;
 
        // Convert the payload to string
        s = pakfire_json_to_string(json);