From 8ff4970e8124757dd84822621134124bf655aa3d Mon Sep 17 00:00:00 2001 From: Sean Sullivan Date: Wed, 2 Nov 2022 00:03:24 +0000 Subject: [PATCH] Get response content-type Kubernetes-commit: 4ca128d71aa94653927b0e529b746cb7428563b1 --- rest/request.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rest/request.go b/rest/request.go index 7aae7aaf57..560f73f002 100644 --- a/rest/request.go +++ b/rest/request.go @@ -1288,6 +1288,14 @@ func (r Result) StatusCode(statusCode *int) Result { return r } +// ContentType returns the "Content-Type" response header into the passed +// string, returning the Result for possible chaining. (Only valid if no +// error code was returned.) +func (r Result) ContentType(contentType *string) Result { + *contentType = r.contentType + return r +} + // Into stores the result into obj, if possible. If obj is nil it is ignored. // If the returned object is of type Status and has .Status != StatusSuccess, the // additional information in Status will be used to enrich the error.