Skip to content

Commit f686b42

Browse files
authored
Update Doc Testing (#157)
- [+] test(2fa_test.go): add note about outdated tests - [+] refactor(middleware.go): combine if statements for setting default JSONMarshal and JSONUnmarshal functions
1 parent 03c4955 commit f686b42

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

2fa_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
//
33
// License: BSD 3-Clause License
44

5+
// Note: The tests here are outdated and won't work. It will crash because the focus is still on improving the internal implementation.
6+
57
package twofa_test
68

79
import (

middleware.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,8 @@ func New(config ...Config) fiber.Handler {
4242
}
4343

4444
// Set default values for JSONMarshal and JSONUnmarshal if not provided
45-
if cfg.JSONMarshal == nil {
45+
if cfg.JSONMarshal == nil && cfg.JSONUnmarshal == nil {
4646
cfg.JSONMarshal = json.Marshal
47-
}
48-
if cfg.JSONUnmarshal == nil {
4947
cfg.JSONUnmarshal = json.Unmarshal
5048
}
5149

0 commit comments

Comments
 (0)