Refactor HTTP request in main.go to use PATCH method and set content type header

This commit is contained in:
Mandresy RABENJAHARISON 2025-08-11 16:04:02 +03:00
parent d6f8214a00
commit 51bd525a4f

View File

@ -87,7 +87,14 @@ func main() {
} }
endpoint := strings.TrimRight(baseURL, "/") + "/api/v1/patch_gitea_odoo" 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 { if err != nil {
logger.Printf("HTTP request failed: %v\n", err) logger.Printf("HTTP request failed: %v\n", err)
os.Exit(1) os.Exit(1)