Skip to content

Commit

Permalink
PR feedback for vars
Browse files Browse the repository at this point in the history
Signed-off-by: steve lasker <[email protected]>
  • Loading branch information
SteveLasker committed Jul 15, 2024
1 parent 0832875 commit e50eda6
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions headers.go
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,8 @@ func validateHeaderParameters(h map[any]any, protected bool) error {
// Reference: https://datatracker.ietf.org/doc/html/rfc8152#section-3.1
switch label {
case HeaderLabelAlgorithm:
_, is_alg := value.(Algorithm)
if !is_alg && !canInt(value) && !canTstr(value) {
_, isAlg := value.(Algorithm)
if !isAlg && !canInt(value) && !canTstr(value) {
return errors.New("header parameter: alg: require int / tstr type")
}
case HeaderLabelCritical:
Expand All @@ -498,11 +498,11 @@ func validateHeaderParameters(h map[any]any, protected bool) error {
return fmt.Errorf("header parameter: crit: %w", err)
}
case HeaderLabelType:
is_tstr := canTstr(value)
if !is_tstr && !canUint(value) {
isTstr := canTstr(value)
if !isTstr && !canUint(value) {
return errors.New("header parameter: type: require tstr / uint type")
}
if is_tstr {
if isTstr {
v := value.(string)
if len(v) == 0 {
return errors.New("header parameter: type: require non-empty string")
Expand All @@ -517,11 +517,11 @@ func validateHeaderParameters(h map[any]any, protected bool) error {
}
}
case HeaderLabelContentType:
is_tstr := canTstr(value)
if !is_tstr && !canUint(value) {
isTstr := canTstr(value)
if !isTstr && !canUint(value) {
return errors.New("header parameter: content type: require tstr / uint type")
}
if is_tstr {
if isTstr {
v := value.(string)
if len(v) == 0 {
return errors.New("header parameter: content type: require non-empty string")
Expand Down

0 comments on commit e50eda6

Please sign in to comment.