bugfix ignored MaxBytesReader
This commit is contained in:
parent
ecbdab8e27
commit
c66aa70f07
|
@ -43,10 +43,7 @@ func InitWebhook(providername string, secret *string, envname string) func() {
|
||||||
secretB := []byte(*secret)
|
secretB := []byte(*secret)
|
||||||
webhooks.AddRouteHandler(providername, func(router chi.Router) {
|
webhooks.AddRouteHandler(providername, func(router chi.Router) {
|
||||||
router.Post("/", func(w http.ResponseWriter, r *http.Request) {
|
router.Post("/", func(w http.ResponseWriter, r *http.Request) {
|
||||||
body := http.MaxBytesReader(w, r.Body, options.DefaultMaxBodySize)
|
r.Body = http.MaxBytesReader(w, r.Body, options.DefaultMaxBodySize)
|
||||||
defer func() {
|
|
||||||
_ = body.Close()
|
|
||||||
}()
|
|
||||||
|
|
||||||
accessToken := r.URL.Query().Get("access_token")
|
accessToken := r.URL.Query().Get("access_token")
|
||||||
if "" != accessToken {
|
if "" != accessToken {
|
||||||
|
|
|
@ -38,10 +38,7 @@ func InitWebhook(providername string, secret *string, envname string) func() {
|
||||||
githubSecretB := []byte(*secret)
|
githubSecretB := []byte(*secret)
|
||||||
webhooks.AddRouteHandler(providername, func(router chi.Router) {
|
webhooks.AddRouteHandler(providername, func(router chi.Router) {
|
||||||
router.Post("/", func(w http.ResponseWriter, r *http.Request) {
|
router.Post("/", func(w http.ResponseWriter, r *http.Request) {
|
||||||
body := http.MaxBytesReader(w, r.Body, options.DefaultMaxBodySize)
|
r.Body = http.MaxBytesReader(w, r.Body, options.DefaultMaxBodySize)
|
||||||
defer func() {
|
|
||||||
_ = body.Close()
|
|
||||||
}()
|
|
||||||
|
|
||||||
payload, err := ioutil.ReadAll(r.Body)
|
payload, err := ioutil.ReadAll(r.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue