From 150d6591be1260f1ef7306bd439b8efb1b0a2fad Mon Sep 17 00:00:00 2001 From: pb Date: Wed, 12 Mar 2025 11:07:45 +0100 Subject: [PATCH] changed status code to 201 when creating resource --- controllers/admiralty.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/controllers/admiralty.go b/controllers/admiralty.go index 3032fbf..1a1dd85 100644 --- a/controllers/admiralty.go +++ b/controllers/admiralty.go @@ -149,6 +149,8 @@ func (c *AdmiraltyController) CreateSource() { // TODO : Return a description of the created resource var respData map[string]interface{} err = json.Unmarshal(res,&respData) + + c.Ctx.Output.SetStatus(201) c.Data["json"] = respData c.ServeJSON() @@ -200,6 +202,7 @@ func (c *AdmiraltyController) CreateAdmiraltyTarget(){ c.Data["json"] = map[string]string{"error": err.Error()} return } + c.Ctx.Output.SetStatus(201) c.Data["json"] = data c.ServeJSON() @@ -258,7 +261,7 @@ func(c *AdmiraltyController) GetKubeSecret() { // @Param execution path string true "execution id of the workflow" // @Param kubeconfig body controllers.Kubeconfig true "Kubeconfig to use when creating secret" -// @Success 200 +// @Success 201 // @router /secret/:execution [post] func (c *AdmiraltyController) CreateKubeSecret() { var kubeconfig RemoteKubeconfig @@ -299,6 +302,7 @@ func (c *AdmiraltyController) CreateKubeSecret() { } err = json.Unmarshal(resp,&respData) + c.Ctx.Output.SetStatus(201) c.Data["json"] = respData c.ServeJSON()