Files
mtusi2026lab5/app/internal/validate/idempotency.go
T

13 lines
284 B
Go

package validate
import "regexp"
var idempotencyKeyPattern = regexp.MustCompile(`^[A-Za-z0-9._:-]{1,128}$`)
func IdempotencyKey(s string) error {
if !idempotencyKeyPattern.MatchString(s) {
return newError("Idempotency-Key", "must match [A-Za-z0-9._:-]{1,128}")
}
return nil
}