MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / HashRequest

Function HashRequest

internal/idempotency/store.go:120–126  ·  view source on GitHub ↗

HashRequest mixes the request path into the body hash so the same Idempotency-Key cannot accidentally replay a cached response across different routes (e.g. reusing a key set on a reply to message A while replying to message B). The path is included on its own line before the body so the hash is una

(path string, body []byte)

Source from the content-addressed store, hash-verified

118// Callers compute this once with the raw body bytes they already
119// have and pass the result to Store.Claim.
120func HashRequest(path string, body []byte) string {
121 h := sha256.New()
122 h.Write([]byte(path))
123 h.Write([]byte{'\n'})
124 h.Write(body)
125 return hex.EncodeToString(h.Sum(nil))
126}
127
128// Claim atomically reserves (userID, key) for the caller. The outcome
129// determines what the HTTP layer should do next:

Callers 2

runIdempotentNSFunction · 0.92
idempotencyGuardMethod · 0.92

Calls 1

WriteMethod · 0.45

Tested by

no test coverage detected