From a02de69e82bad7304a210c89902c7cffbfc13552 Mon Sep 17 00:00:00 2001 From: Wazir Ahmed Date: Wed, 22 Oct 2025 11:52:38 +0530 Subject: [PATCH] TAP: Add `Content-Type` header for POST requests Signed-off-by: Wazir Ahmed --- test/tap/tap/utils.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/tap/tap/utils.cpp b/test/tap/tap/utils.cpp index 388ad475a..631dfc017 100644 --- a/test/tap/tap/utils.cpp +++ b/test/tap/tap/utils.cpp @@ -744,12 +744,17 @@ CURLcode perform_simple_post( ) { CURL *curl; CURLcode res; + struct curl_slist *headers = NULL; curl_global_init(CURL_GLOBAL_ALL); curl = curl_easy_init(); if(curl) { curl_easy_setopt(curl, CURLOPT_URL, endpoint.c_str()); + + headers = curl_slist_append(headers, "Content-Type: application/json"); + curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); + curl_easy_setopt(curl, CURLOPT_POSTFIELDS, params.c_str()); struct memory response = { 0 }; curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback); @@ -765,6 +770,7 @@ CURLcode perform_simple_post( } free(response.data); + curl_slist_free_all(headers); curl_easy_cleanup(curl); }