Skip to content

Commit

Permalink
minor bug fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
Dodi Triwibowo committed Jun 28, 2020
1 parent e9b2ec3 commit d26a665
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ go 1.13
require (
github.com/gorilla/handlers v1.4.2
github.com/gorilla/mux v1.7.4
github.com/verzth/go-utils v0.2.0
github.com/verzth/go-utils v0.2.2
)
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ github.com/verzth/go-utils v0.1.1 h1:IZeqWr5IP/bgVYIHZXrCQe3rx9/WUJaRrDnF5vlOOtA
github.com/verzth/go-utils v0.1.1/go.mod h1:VRAnwae+xXZT8FwlbZFKmgUB5U/DzHAfuREIxitR/FA=
github.com/verzth/go-utils v0.2.0 h1:/xKY7N2Ktn7jgRGrL8oRUskwrMDLTIKEozotkl50SQA=
github.com/verzth/go-utils v0.2.0/go.mod h1:VRAnwae+xXZT8FwlbZFKmgUB5U/DzHAfuREIxitR/FA=
github.com/verzth/go-utils v0.2.2 h1:uNID0XMLEGKh5IK4/RmtC66gLXVSMjDGdPe7EBy/g5c=
github.com/verzth/go-utils v0.2.2/go.mod h1:VRAnwae+xXZT8FwlbZFKmgUB5U/DzHAfuREIxitR/FA=
13 changes: 3 additions & 10 deletions request.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ func TouchRequest(r *http.Request, w http.ResponseWriter) *Request {
if strings.Contains(contentType, "multipart/form-data") {
contentType = "multipart/form-data"
}
switch contentType {
case "multipart/form-data":{
if strings.Contains(contentType, "multipart/form-data"){
if r.Method == http.MethodGet {
return req
}
Expand All @@ -140,9 +139,7 @@ func TouchRequest(r *http.Request, w http.ResponseWriter) *Request {
for k, v := range r.MultipartForm.File {
req.files[k] = scanFiles(v)
}
break
}
case "application/x-www-form-urlencoded":{
}else if strings.Contains(contentType, "application/x-www-form-urlencoded"){
if r.Method == http.MethodGet {
return req
}
Expand All @@ -154,9 +151,7 @@ func TouchRequest(r *http.Request, w http.ResponseWriter) *Request {
for k, v := range r.PostForm {
req.params[k] = scan(v)
}
break
}
case "application/json":{
}else if strings.Contains(contentType, "application/json"){
b := bytes.NewBuffer(make([]byte,0))
reader := io.TeeReader(r.Body, b)

Expand All @@ -169,8 +164,6 @@ func TouchRequest(r *http.Request, w http.ResponseWriter) *Request {
w.WriteHeader(http.StatusInternalServerError)
return req
}
break
}
}
break
}
Expand Down

0 comments on commit d26a665

Please sign in to comment.