mirror of
https://github.com/GlueOps/autoglue.git
synced 2026-02-13 21:00:06 +01:00
feat: sdk migration in progress
This commit is contained in:
20
terraform-provider-autoglue/internal/provider/http_err.go
Normal file
20
terraform-provider-autoglue/internal/provider/http_err.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package provider
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func httpErr(err error, resp *http.Response) string {
|
||||
if resp == nil {
|
||||
return err.Error()
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
b, _ := io.ReadAll(resp.Body)
|
||||
return fmt.Sprintf("status=%d: %s (body=%s)", resp.StatusCode, resp.Status, string(b))
|
||||
}
|
||||
|
||||
func isNotFound(resp *http.Response) bool {
|
||||
return resp != nil && resp.StatusCode == http.StatusNotFound
|
||||
}
|
||||
Reference in New Issue
Block a user