Skip to content

Conversation

the-wagness
Copy link

I was using parser options to set WithIssuedAt() in my application code, and noticed my unit test unexpectedly did not fail when my test JWTs omitted this field.

Upon inspecting the code, I found Validate() seemed to pass v.verifyIssuedAt the value false for the required argument, which effectively ignores validation for this field when its explicitly configured via WithIssuedAt().

Further, I added a testcase to the validator_test.go unit tests, and found that my unit test was not failing when I changed back to the old code. Upon inspection, I found that an errant if statement was only testing if the error messages matched if there was an error at all, which will not test if there is not an error even when one is expected.

@the-wagness
Copy link
Author

Closing this PR as I have found this behavior is intentional per: #411

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant