From 66b9e9b5c10c5e59f81840796cb9fd5ae72b8cc5 Mon Sep 17 00:00:00 2001 From: Mo Tarbin Date: Mon, 26 Jan 2026 23:08:13 -0500 Subject: [PATCH] fix: Ensure 'Content-Type' header is set for POST, PUT, and DELETE requests --- src/utils/ApiClient.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/utils/ApiClient.js b/src/utils/ApiClient.js index 82db51e..d001063 100644 --- a/src/utils/ApiClient.js +++ b/src/utils/ApiClient.js @@ -100,7 +100,6 @@ class ApiClient { getHeaders(customHeaders = {}) { const headers = { - 'Content-Type': 'application/json', ...customHeaders, } @@ -231,6 +230,10 @@ class ApiClient { } async post(endpoint, data, options = {}) { + options.headers = options.headers || {} + if (!options.headers['Content-Type']) { + options.headers['Content-Type'] = 'application/json' + } return this.request(endpoint, { ...options, method: 'POST', @@ -239,6 +242,10 @@ class ApiClient { } async put(endpoint, data, options = {}) { + options.headers = options.headers || {} + if (!options.headers['Content-Type']) { + options.headers['Content-Type'] = 'application/json' + } return this.request(endpoint, { ...options, method: 'PUT', @@ -247,6 +254,10 @@ class ApiClient { } async delete(endpoint, options = {}) { + options.headers = options.headers || {} + if (!options.headers['Content-Type']) { + options.headers['Content-Type'] = 'application/json' + } return this.request(endpoint, { ...options, method: 'DELETE' }) }