bugfix ignored MaxBytesReader

This commit is contained in:
AJ ONeal 2020-09-29 03:57:49 -06:00
parent ecbdab8e27
commit c66aa70f07
2 changed files with 2 additions and 8 deletions

View File

@ -43,10 +43,7 @@ func InitWebhook(providername string, secret *string, envname string) func() {
secretB := []byte(*secret)
webhooks.AddRouteHandler(providername, func(router chi.Router) {
router.Post("/", func(w http.ResponseWriter, r *http.Request) {
body := http.MaxBytesReader(w, r.Body, options.DefaultMaxBodySize)
defer func() {
_ = body.Close()
}()
r.Body = http.MaxBytesReader(w, r.Body, options.DefaultMaxBodySize)
accessToken := r.URL.Query().Get("access_token")
if "" != accessToken {

View File

@ -38,10 +38,7 @@ func InitWebhook(providername string, secret *string, envname string) func() {
githubSecretB := []byte(*secret)
webhooks.AddRouteHandler(providername, func(router chi.Router) {
router.Post("/", func(w http.ResponseWriter, r *http.Request) {
body := http.MaxBytesReader(w, r.Body, options.DefaultMaxBodySize)
defer func() {
_ = body.Close()
}()
r.Body = http.MaxBytesReader(w, r.Body, options.DefaultMaxBodySize)
payload, err := ioutil.ReadAll(r.Body)
if err != nil {