Skip to content

Commit

Permalink
Merge pull request #11 from TIT8/patch
Browse files Browse the repository at this point in the history
Patch
  • Loading branch information
TIT8 committed Aug 28, 2023
2 parents f447ed3 + bdd6603 commit 4000b05
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions form-api.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ func handler_get(w http.ResponseWriter, r *http.Request) {
return
}

r.Body = http.MaxBytesReader(w, r.Body, 100)

fmt.Fprintf(w, "Ciao %s\n", r.Host)

}
Expand All @@ -80,6 +82,8 @@ func handler_post(w http.ResponseWriter, r *http.Request) {
return
}

r.Body = http.MaxBytesReader(w, r.Body, 50*1024)

w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Access-Control-Allow-Headers", "Content-Type")

Expand All @@ -90,12 +94,12 @@ func handler_post(w http.ResponseWriter, r *http.Request) {
log.Printf("Content-Type is multipart/form-data? %v\n", content_type)

if content_type {
err = r.ParseMultipartForm(100)
err = r.ParseMultipartForm(1000)
} else {
err = r.ParseForm()
}
if err != nil {
w.WriteHeader(http.StatusUnsupportedMediaType)
http.Error(w, err.Error(), http.StatusUnsupportedMediaType)
log.Fatal(err)
}

Expand Down

0 comments on commit 4000b05

Please sign in to comment.