IdempotencyGuardForTest exposes API.idempotencyGuard so tests in the external agent_test package can verify the side-effect-committed caching policy end-to-end (the standard handlers don't have a natural way to reach the "5xx after side effect" branch in a unit test).
(w http.ResponseWriter, r *http.Request, userID string, bodyBytes []byte)
| 35 | // natural way to reach the "5xx after side effect" branch in a unit |
| 36 | // test). |
| 37 | func (a *API) IdempotencyGuardForTest(w http.ResponseWriter, r *http.Request, userID string, bodyBytes []byte) (replayed bool, out http.ResponseWriter, finalize func()) { |
| 38 | return a.idempotencyGuard(w, r, userID, bodyBytes) |
| 39 | } |
| 40 | |
| 41 | // MarkSideEffectCommittedForTest exposes markSideEffectCommitted so |
| 42 | // the external test harness can flip the cache-on-error flag from |
no test coverage detected