diff --git a/api/myshoes/http.go b/api/myshoes/http.go index 4c78cf9..7aa1083 100644 --- a/api/myshoes/http.go +++ b/api/myshoes/http.go @@ -3,6 +3,7 @@ package myshoes import ( "encoding/json" "fmt" + "io" "net/http" "github.com/whywaita/myshoes/pkg/web" @@ -11,8 +12,15 @@ import ( func decodeBody(resp *http.Response, out interface{}) error { defer resp.Body.Close() - decoder := json.NewDecoder(resp.Body) - return decoder.Decode(out) + body, err := io.ReadAll(resp.Body) + if err != nil { + return fmt.Errorf("failed to io.ReadAll(resp.Body): %w", err) + } + + if err := json.Unmarshal(body, out); err != nil { + return fmt.Errorf("failed to json.Unmarshal() (out: %s): %w", body, err) + } + return nil } func decodeErrorBody(resp *http.Response) error { diff --git a/pkg/runner/runner_delete.go b/pkg/runner/runner_delete.go index 4445bfc..4d6cecd 100644 --- a/pkg/runner/runner_delete.go +++ b/pkg/runner/runner_delete.go @@ -124,6 +124,7 @@ func (m *Manager) removeRunners(ctx context.Context, t datastore.Target) error { func (m *Manager) removeRunner(ctx context.Context, t datastore.Target, runner datastore.Runner, ghRunners []*github.Runner) error { if err := sanitizeRunnerMustRunningTime(runner); errors.Is(err, ErrNotWillDeleteRunner) { + logger.Logf(false, "%s is not running MustRunningTime", runner.UUID) return nil }