Merge pull request #79673 from cheftako/bugFix
Making sure we handle error on http.NewRequest() in streamer Kubernetes-commit: 13c07e5327d912830a2f0c9f27b673de469cb613
This commit is contained in:
commit
92171d74d8
|
|
@ -19,6 +19,7 @@ package rest
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
@ -66,6 +67,9 @@ func (s *LocationStreamer) InputStream(ctx context.Context, apiVersion, acceptHe
|
||||||
CheckRedirect: s.RedirectChecker,
|
CheckRedirect: s.RedirectChecker,
|
||||||
}
|
}
|
||||||
req, err := http.NewRequest("GET", s.Location.String(), nil)
|
req, err := http.NewRequest("GET", s.Location.String(), nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, false, "", fmt.Errorf("failed to construct request for %s, got %v", s.Location.String(), err)
|
||||||
|
}
|
||||||
// Pass the parent context down to the request to ensure that the resources
|
// Pass the parent context down to the request to ensure that the resources
|
||||||
// will be release properly.
|
// will be release properly.
|
||||||
req = req.WithContext(ctx)
|
req = req.WithContext(ctx)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue