Fix segfault on scheme-less instance URL

Since it cannot connect at all, there’s never a response to look into.
Even with --debug this is hard to spot in current logs prior to the
segfault.
This commit is contained in:
Oneric 2025-02-17 23:20:20 +01:00
commit 1949ae2874

View file

@ -15,9 +15,10 @@ func Post(url string, body interface{}) (*http.Response, error) {
return nil, err
}
resp, err := http.Post(url, "application/json", bytes.NewBuffer(jsonBody))
log.Debugf("Status: %d", resp.StatusCode)
if err != nil {
log.Fatalf("Failed to connect: %s", err)
return nil, err
}
log.Debugf("Status: %d", resp.StatusCode)
return resp, nil
}