From: Vsevolod Stakhov Date: Mon, 26 Jan 2026 16:40:19 +0000 (+0000) Subject: [Fix] GPT plugin: explicitly set POST method for API requests X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d3edf80082ddfd8f3010da5e5aaf7bdece04226e;p=thirdparty%2Frspamd.git [Fix] GPT plugin: explicitly set POST method for API requests Fixes #5859 Some API providers (like Ollama) strictly require POST method on their endpoints and return 405 Method Not Allowed for GET requests. While rspamd_http auto-detects POST when a body is present, explicitly setting the method ensures correct behavior in all cases. --- diff --git a/src/plugins/lua/gpt.lua b/src/plugins/lua/gpt.lua index 68c31e4d6b..aa1d3c0ce6 100644 --- a/src/plugins/lua/gpt.lua +++ b/src/plugins/lua/gpt.lua @@ -986,6 +986,7 @@ local function openai_check(task, content, sel_part, context_snippet) upstream = settings.upstreams:get_upstream_round_robin() local http_params = { url = settings.url, + method = 'post', mime_type = 'application/json', timeout = settings.timeout, log_obj = task, @@ -1122,6 +1123,7 @@ local function ollama_check(task, content, sel_part, context_snippet) upstream = settings.upstreams:get_upstream_round_robin() local http_params = { url = settings.url, + method = 'post', mime_type = 'application/json', timeout = settings.timeout, log_obj = task,