This is an automated email from the ASF dual-hosted git repository.

zhangliang2022 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/main by this push:
     new 452cfcccc feat: move skipCollectors params from query to body (#5393)
452cfcccc is described below

commit 452cfcccc1be88da4a3b1d729dd1ba84fb6f0431
Author: abeizn <[email protected]>
AuthorDate: Wed Jun 7 14:44:54 2023 +0800

    feat: move skipCollectors params from query to body (#5393)
---
 backend/server/api/blueprints/blueprints.go | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/backend/server/api/blueprints/blueprints.go 
b/backend/server/api/blueprints/blueprints.go
index 85f927077..d7517a664 100644
--- a/backend/server/api/blueprints/blueprints.go
+++ b/backend/server/api/blueprints/blueprints.go
@@ -168,10 +168,10 @@ func Patch(c *gin.Context) {
 // @Tags framework/blueprints
 // @Accept application/json
 // @Param blueprintId path string true "blueprintId"
-// @Param skipCollectors query bool false "skipCollectors"
-// @Success 200  {object} models.Pipeline
-// @Failure 400  {object} shared.ApiBody "Bad Request"
-// @Failure 500  {object} shared.ApiBody "Internal Error"
+// @Param skipCollectors body bool false "skipCollectors"
+// @Success 200 {object} models.Pipeline
+// @Failure 400 {object} shared.ApiBody "Bad Request"
+// @Failure 500 {object} shared.ApiBody "Internal Error"
 // @Router /blueprints/{blueprintId}/trigger [Post]
 func Trigger(c *gin.Context) {
        blueprintId := c.Param("blueprintId")
@@ -181,8 +181,16 @@ func Trigger(c *gin.Context) {
                return
        }
 
-       skipCollectors := c.Query("skipCollectors") == "true"
-       pipeline, err := services.TriggerBlueprint(id, skipCollectors)
+       var body struct {
+               SkipCollectors bool `json:"skipCollectors"`
+       }
+       err = c.ShouldBindJSON(&body)
+       if err != nil {
+               shared.ApiOutputError(c, errors.BadInput.Wrap(err, "error 
binding request body"))
+               return
+       }
+
+       pipeline, err := services.TriggerBlueprint(id, body.SkipCollectors)
        if err != nil {
                shared.ApiOutputError(c, errors.Default.Wrap(err, "error 
triggering blueprint"))
                return

Reply via email to