Commit 8625cae
authored
Merge pull request #51 from RexSkz/rex/prevent-panic-caused-by-null-value
If the request body is a JSON like `{"test":null}`, govalidator will panic when executing `traverseMap`.
```go
var m = make(map[string]interface{})
json.Unmarshal([]byte(`{"test":null}`), &m)
```
Since `m["test"]` is `nil`, `reflect.TypeOf(v)` will panic. This PR fixes the bug by dropping null values in json.2 files changed
+5
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
186 | 190 | | |
187 | 191 | | |
188 | 192 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
86 | 87 | | |
87 | 88 | | |
88 | 89 | | |
| |||
0 commit comments