Refactor HTTP request in main.go to use PATCH method and set content type header
This commit is contained in:
parent
d6f8214a00
commit
51bd525a4f
9
main.go
9
main.go
@ -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)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user