From db4031f13d0de1333b98c13659f7f279bc690963 Mon Sep 17 00:00:00 2001 From: Konrad Bańka Date: Thu, 11 Mar 2021 10:58:37 +0100 Subject: Correct Day2 Config Template creation response MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modified day2 config template handler to return metadata of created configuration template on its creation. Issue-ID: MULTICLOUD-1311 Signed-off-by: Konrad Bańka Change-Id: I139486a41c7dbd67d414a07776e9a5d711d9887b --- src/k8splugin/api/configtemplatehandler.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/k8splugin') diff --git a/src/k8splugin/api/configtemplatehandler.go b/src/k8splugin/api/configtemplatehandler.go index 641e4206..bd7c2db9 100644 --- a/src/k8splugin/api/configtemplatehandler.go +++ b/src/k8splugin/api/configtemplatehandler.go @@ -64,8 +64,13 @@ func (h rbTemplateHandler) createHandler(w http.ResponseWriter, r *http.Request) return } - w.WriteHeader(http.StatusNoContent) - + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusCreated) + err = json.NewEncoder(w).Encode(p) + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } } // uploadHandler handles upload of the template tar file into the database -- cgit 1.2.3-korg