Fix hydra consent session parsing and audit detail tests

This commit is contained in:
Lectom C Han committed 2026-02-06 17:30:21 +09:00
1 parent 3a6ae4948a
commit 226de652e3
2 files changed
+47 -2

No files matched your search

@@ -240,14 +240,20 @@ func (s *HydraAdminService) ListConsentSessions(ctx context.Context, subject, cl
}
defer resp.Body.Close()
body, _ := io.ReadAll(io.LimitReader(resp.Body, 4096))
if resp.StatusCode == http.StatusNoContent {
return []domain.HydraConsentSession{}, nil
}
body, _ := io.ReadAll(io.LimitReader(resp.Body, 1024*1024))
if resp.StatusCode >= 300 {
return nil, fmt.Errorf("hydra admin: list consent sessions failed status=%d body=%s", resp.StatusCode, string(body))
}
if len(body) == 0 {
return []domain.HydraConsentSession{}, nil
}
var sessions []domain.HydraConsentSession
if err := json.Unmarshal(body, &sessions); err != nil {
return nil, fmt.Errorf("hydra admin: decode consent sessions failed: %w", err)
return nil, fmt.Errorf("hydra admin: decode consent sessions failed: %w body=%s", err, string(body))
}
return sessions, nil
}