Skip to content

Commit 152f2c4

Browse files
committed
refactor: removed pointer type checker on JSON data
1 parent d0e3618 commit 152f2c4

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

http/json/data.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ import (
44
goflagsmode "github.com/ralvarezdev/go-flags/mode"
55
gonethttp "github.com/ralvarezdev/go-net/http"
66
"net/http"
7-
"reflect"
87
)
98

10-
// checkJSONData checks if the given JSON data is nil or if the reflected data is not a pointer
9+
// checkJSONData checks if the given JSON data is nil
1110
func checkJSONData(
1211
w http.ResponseWriter,
1312
data interface{},
@@ -17,11 +16,6 @@ func checkJSONData(
1716
if data == nil {
1817
return handleDataTypeError(w, ErrNilJSONData, mode)
1918
}
20-
21-
// Check if the reflected data is a pointer
22-
if reflect.ValueOf(data).Kind() != reflect.Ptr {
23-
return handleDataTypeError(w, ErrJSONDataMustBeAPointer, mode)
24-
}
2519
return nil
2620
}
2721

0 commit comments

Comments
 (0)