From 82d101a6fa3f6e120c4abec7c3f42ee971c2fd1a Mon Sep 17 00:00:00 2001 From: Cao Shufeng Date: Sun, 8 Apr 2018 11:59:41 +0800 Subject: [PATCH] fix "kubectl create --raw" --- pkg/kubectl/cmd/create/create.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/kubectl/cmd/create/create.go b/pkg/kubectl/cmd/create/create.go index 66bf40555db..0a593a93b36 100644 --- a/pkg/kubectl/cmd/create/create.go +++ b/pkg/kubectl/cmd/create/create.go @@ -264,12 +264,16 @@ func (o *CreateOptions) raw(f cmdutil.Factory) error { } } // TODO post content with stream. Right now it ignores body content - bytes, err := restClient.Post().RequestURI(o.Raw).Body(data).DoRaw() + result := restClient.Post().RequestURI(o.Raw).Body(data).Do() + if err := result.Error(); err != nil { + return err + } + body, err := result.Raw() if err != nil { return err } - fmt.Fprintf(o.Out, "%v", string(bytes)) + fmt.Fprintf(o.Out, "%v", string(body)) return nil }