From c693ffaff6f0d85ff223a99d186a0f51d1bd7eee Mon Sep 17 00:00:00 2001 From: smittal22 Date: Mon, 6 Feb 2023 12:15:42 -0800 Subject: [PATCH] reset the status code to 500 in case we encounter an error --- cns/restserver/api.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cns/restserver/api.go b/cns/restserver/api.go index c6a56e9cd9..5fcb736021 100644 --- a/cns/restserver/api.go +++ b/cns/restserver/api.go @@ -1239,6 +1239,10 @@ func (service *HTTPRestService) publishNetworkContainer(w http.ResponseWriter, r returnCode = types.UnsupportedVerb } + if returnCode != 0 { + publishStatusCode = http.StatusInternalServerError + } + // create a synthetic response from NMAgent so that clients that previously // relied on its presence can continue to do so. publishResponseBody := fmt.Sprintf(`{"httpStatusCode":"%d"}`, publishStatusCode) @@ -1350,6 +1354,10 @@ func (service *HTTPRestService) unpublishNetworkContainer(w http.ResponseWriter, returnCode = types.UnsupportedVerb } + if returnCode != 0 { + unpublishStatusCode = http.StatusInternalServerError + } + // create a synthetic response from NMAgent so that clients that previously // relied on its presence can continue to do so. unpublishResponseBody := fmt.Sprintf(`{"httpStatusCode":"%d"}`, unpublishStatusCode)