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) {
9899func 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