Nil request body with retry

This commit is contained in:
Ludovic Fernandez 2018-10-23 10:10:04 +02:00 committed by Traefiker Bot
parent 37d8e32e0b
commit 3f044c48fa
4 changed files with 6 additions and 3 deletions

View file

@ -35,6 +35,9 @@ func (retry *Retry) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
// cf https://github.com/containous/traefik/issues/1008
if retry.attempts > 1 {
body := r.Body
if body == nil {
body = http.NoBody
}
defer body.Close()
r.Body = ioutil.NopCloser(body)
}