forked from mtusi2026/mtusi2026lab5
13 lines
284 B
Go
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
|
|
}
|