Skip to content

Commit d03040a

Browse files
committed
debugggggggging
1 parent 2a2907b commit d03040a

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

utils/request/request.go

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"net/http"
88
"strings"
99

10+
"github.com/codeshelldev/secured-signal-api/utils/logger"
1011
"github.com/codeshelldev/secured-signal-api/utils/query"
1112
)
1213

@@ -98,6 +99,8 @@ func GetBody(req *http.Request) ([]byte, error) {
9899
func GetReqBody(w http.ResponseWriter, req *http.Request) (Body, error) {
99100
bytes, err := GetBody(req)
100101

102+
logger.Dev(string(bytes))
103+
101104
var isEmpty bool
102105

103106
if err != nil {
@@ -113,22 +116,22 @@ func GetReqBody(w http.ResponseWriter, req *http.Request) (Body, error) {
113116
var data map[string]any
114117

115118
switch GetBodyType(req) {
116-
case Json:
117-
data, err = GetJsonData(bytes)
119+
case Json:
120+
data, err = GetJsonData(bytes)
118121

119-
if err != nil {
120-
http.Error(w, "Bad Request: invalid JSON", http.StatusBadRequest)
122+
if err != nil {
123+
http.Error(w, "Bad Request: invalid JSON", http.StatusBadRequest)
121124

122-
return Body{Empty: true}, err
123-
}
124-
case Form:
125-
data, err = GetFormData(bytes)
125+
return Body{Empty: true}, err
126+
}
127+
case Form:
128+
data, err = GetFormData(bytes)
126129

127-
if err != nil {
128-
http.Error(w, "Bad Request: invalid Form", http.StatusBadRequest)
130+
if err != nil {
131+
http.Error(w, "Bad Request: invalid Form", http.StatusBadRequest)
129132

130-
return Body{Empty: true}, err
131-
}
133+
return Body{Empty: true}, err
134+
}
132135
}
133136

134137
isEmpty = len(data) <= 0

0 commit comments

Comments
 (0)