Skip to content

Commit 0cba7e7

Browse files
committed
Improve readme formatting
1 parent 6477ba4 commit 0cba7e7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ e.GET("/", func(c echo.Context) error {
6767

6868
## IMPORTANT: Integration Testing with JWT Library
6969

70-
Ensure that your project includes at least one integration test to detect changes in major versions of the JWT library early.
71-
This is crucial because type assertions like token := c.Get("user").(*jwt.Token) may fail silently if the imported version of the JWT library (e.g., import "github.com/golang-jwt/jwt/v5") differs from the version used internally by dependencies (e.g., echo-jwt may now use v6). Such discrepancies can lead to invalid casts, causing your handlers to panic or throw errors. Integration tests help safeguard against these version mismatches.
70+
Ensure that your project includes at least one integration test to detect changes in major versions of the `golang-jwt/jwt` library early.
71+
This is crucial because type assertions like `token := c.Get("user").(*jwt.Token)` may fail silently if the imported version of the JWT library (e.g., `import "github.com/golang-jwt/jwt/v5"`) differs from the version used internally by dependencies (e.g., echo-jwt may now use `v6`). Such discrepancies can lead to invalid casts, causing your handlers to panic or throw errors. Integration tests help safeguard against these version mismatches.
7272

7373
```go
7474
func TestIntegrationMiddlewareWithHandler(t *testing.T) {
@@ -77,7 +77,7 @@ func TestIntegrationMiddlewareWithHandler(t *testing.T) {
7777
SigningKey: []byte("secret"),
7878
}))
7979

80-
// use handler that gets token from context to fail your CI flow when JWT library version changes
80+
// use handler that gets token from context to fail your CI flow when `golang-jwt/jwt` library version changes
8181
// a) `token, ok := c.Get("user").(*jwt.Token)`
8282
// b) `token := c.Get("user").(*jwt.Token)`
8383
e.GET("/example", exampleHandler)

0 commit comments

Comments
 (0)