@@ -1209,15 +1209,21 @@ func (handler *PipelineConfigRestHandlerImpl) FetchMaterialInfo(w http.ResponseW
12091209
12101210func (handler * PipelineConfigRestHandlerImpl ) GetCIPipelineById (w http.ResponseWriter , r * http.Request ) {
12111211 token := r .Header .Get ("token" )
1212- vars := mux .Vars (r )
1213- appId , err := strconv .Atoi (vars ["appId" ])
1212+ // vars := mux.Vars(r)
1213+ //appId, err := strconv.Atoi(vars["appId"])
1214+ appId , err := common .ExtractIntPathParamWithContext (w , r , "appId" , "app" )
12141215 if err != nil {
1215- common .WriteJsonResp (w , err , nil , http .StatusBadRequest )
1216+ // response already written by ExtractIntPathParamWithContext
1217+ //common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
1218+ handler .Logger .Error ("request err getting , GetCIPipelineById" , "appId" , appId , "err" , err )
12161219 return
12171220 }
1218- pipelineId , err := strconv .Atoi (vars ["pipelineId" ])
1221+ //pipelineId, err := strconv.Atoi(vars["pipelineId"])
1222+ pipelineId , err := common .ExtractIntPathParamWithContext (w , r , "pipelineId" , "pipeline" )
12191223 if err != nil {
1220- common .WriteJsonResp (w , err , nil , http .StatusBadRequest )
1224+ // response already written by ExtractIntPathParamWithContext
1225+ // common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
1226+ handler .Logger .Error ("request err getting , GetCIPipelineById" , "pipelineId" , pipelineId , "err" , err )
12211227 return
12221228 }
12231229
@@ -1711,20 +1717,29 @@ func (handler *PipelineConfigRestHandlerImpl) FetchWorkflowDetails(w http.Respon
17111717 common .HandleUnauthorized (w , r )
17121718 return
17131719 }
1714- vars := mux .Vars (r )
1715- appId , err := strconv .Atoi (vars ["appId" ])
1720+ // vars := mux.Vars(r)
1721+ // appId, err = strconv.Atoi(vars["appId"])
1722+ appId , err := common .ExtractIntPathParamWithContext (w , r , "appId" , "app" )
17161723 if err != nil {
1717- common .WriteJsonResp (w , err , nil , http .StatusBadRequest )
1724+ // response already written by ExtractIntPathParamWithContext
1725+ // common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
1726+ handler .Logger .Error ("request err getting , FetchWorkflowDetails" , "appId" , appId , "err" , err )
17181727 return
17191728 }
1720- pipelineId , err := strconv .Atoi (vars ["pipelineId" ])
1729+ // pipelineId, err := strconv.Atoi(vars["pipelineId"])
1730+ pipelineId , err := common .ExtractIntPathParamWithContext (w , r , "pipelineId" , "pipeline" )
17211731 if err != nil {
1722- common .WriteJsonResp (w , err , nil , http .StatusBadRequest )
1732+ // response already written by ExtractIntPathParamWithContext
1733+ // common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
1734+ handler .Logger .Error ("request err getting , FetchWorkflowDetails" , "pipelineId" , pipelineId , "err" , err )
17231735 return
17241736 }
1725- buildId , err := strconv .Atoi (vars ["workflowId" ])
1737+ // buildId, err := strconv.Atoi(vars["workflowId"])
1738+ buildId , err := common .ExtractIntPathParamWithContext (w , r , "workflowId" , "workflow" )
17261739 if err != nil || buildId == 0 {
1727- common .WriteJsonResp (w , err , nil , http .StatusBadRequest )
1740+ // response already written by ExtractIntPathParamWithContext
1741+ // common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
1742+ handler .Logger .Error ("request err getting , FetchWorkflowDetails" , "buildId" , buildId , "err" , err )
17281743 return
17291744 }
17301745 handler .Logger .Infow ("request payload, FetchWorkflowDetails" , "appId" , appId , "pipelineId" , pipelineId , "buildId" , buildId , "buildId" , buildId )
0 commit comments