From 51bd525a4fe50783c7f7faf0fe20a011e45d3310 Mon Sep 17 00:00:00 2001 From: Mandresy RABENJAHARISON Date: Mon, 11 Aug 2025 16:04:02 +0300 Subject: [PATCH] Refactor HTTP request in main.go to use PATCH method and set content type header --- main.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 58a4dde..ea1333a 100644 --- a/main.go +++ b/main.go @@ -87,7 +87,14 @@ func main() { } endpoint := strings.TrimRight(baseURL, "/") + "/api/v1/patch_gitea_odoo" - resp, err := http.Post(endpoint, "application/json", bytes.NewBuffer(payloadBytes)) + req, err := http.NewRequest(http.MethodPatch, endpoint, bytes.NewBuffer(payloadBytes)) + if err != nil { + logger.Printf("Error creating HTTP request: %v\n", err) + os.Exit(1) + } + req.Header.Set("Content-Type", "application/json") + + resp, err := http.DefaultClient.Do(req) if err != nil { logger.Printf("HTTP request failed: %v\n", err) os.Exit(1)