mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 21:08:10 -05:00
HTTP endpoints cleanup (#13251)
* remove validation package * structs cleanup * merge with apimiddleware removal * more validation and Bls capitalization * builder test fix * use strconv for uint->str conversions * use DecodeHexWithLength * use exact param names * rename http package to httputil * change conversions to fmt.Sprintf * handle query paramsd and route variables * spans and receiver name * split structs, move bytes helper * missing ok check * fix reference to indexed failure * errors fixup * add godoc to helper * fix BLS casing and chainhead ref * review * fix import in tests * gzl
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package slice
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
||||
@@ -391,3 +392,12 @@ func Reverse[E any](s []E) []E {
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
// VerifyMaxLength takes a slice and a maximum length and validates the length.
|
||||
func VerifyMaxLength[T any](v []T, max int) error {
|
||||
l := len(v)
|
||||
if l > max {
|
||||
return fmt.Errorf("length of %d exceeds max of %d", l, max)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user