Skip to content

Commit

Permalink
return an error if no httpClient is provided
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
  • Loading branch information
inteon committed Feb 1, 2023
1 parent 5db1738 commit e4cb6fe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/client/apiutil/apimachinery.go
Expand Up @@ -64,7 +64,7 @@ func AddToProtobufScheme(addToScheme func(*runtime.Scheme) error) error {
// information fetched by a new client with the given config.
func NewDiscoveryRESTMapper(c *rest.Config, httpClient *http.Client) (meta.RESTMapper, error) {
if httpClient == nil {
panic("httpClient must not be nil")
return nil, fmt.Errorf("httpClient must not be nil")
}

// Get a mapper
Expand Down Expand Up @@ -157,7 +157,7 @@ func GVKForObject(obj runtime.Object, scheme *runtime.Scheme) (schema.GroupVersi
// baseConfig, if set, otherwise a default serializer will be set.
func RESTClientForGVK(gvk schema.GroupVersionKind, isUnstructured bool, baseConfig *rest.Config, codecs serializer.CodecFactory, httpClient *http.Client) (rest.Interface, error) {
if httpClient == nil {
panic("httpClient must not be nil")
return nil, fmt.Errorf("httpClient must not be nil")
}
return rest.RESTClientForConfigAndClient(createRestConfig(gvk, isUnstructured, baseConfig, codecs), httpClient)
}
Expand Down

0 comments on commit e4cb6fe

Please sign in to comment.