From 363af77a7e865614b4b76bfdf6adf835a97c03ab Mon Sep 17 00:00:00 2001 From: ubuntu Date: Fri, 9 Aug 2024 12:27:59 +0000 Subject: [PATCH] fix: gin context parameter --- internal/sbi/api_parameterprovision.go | 2 +- internal/sbi/api_subscriberdatamanagement.go | 11 ++++------- internal/sbi/api_ueauthentication.go | 1 - 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/internal/sbi/api_parameterprovision.go b/internal/sbi/api_parameterprovision.go index aef8ba0..2971bd3 100644 --- a/internal/sbi/api_parameterprovision.go +++ b/internal/sbi/api_parameterprovision.go @@ -60,7 +60,7 @@ func (s *Server) HandleUpdate(c *gin.Context) { return } - gpsi := c.Params.ByName("gpsi") + gpsi := c.Params.ByName("ueId") if gpsi == "" { problemDetails := &models.ProblemDetails{ Status: http.StatusBadRequest, diff --git a/internal/sbi/api_subscriberdatamanagement.go b/internal/sbi/api_subscriberdatamanagement.go index c286d76..c8a2acd 100644 --- a/internal/sbi/api_subscriberdatamanagement.go +++ b/internal/sbi/api_subscriberdatamanagement.go @@ -205,7 +205,7 @@ func (s *Server) HandleSubscribe(c *gin.Context) { logger.SdmLog.Infof("Handle Subscribe") - supi := c.Params.ByName("supi") + supi := c.Params.ByName("ueId") s.Processor().SubscribeProcedure(c, &sdmSubscriptionReq, supi) } @@ -214,7 +214,7 @@ func (s *Server) HandleSubscribe(c *gin.Context) { func (s *Server) HandleUnsubscribe(c *gin.Context) { logger.SdmLog.Infof("Handle Unsubscribe") - supi := c.Params.ByName("supi") + supi := c.Params.ByName("ueId") subscriptionID := c.Params.ByName("subscriptionId") s.Processor().UnsubscribeProcedure(c, supi, subscriptionID) @@ -259,7 +259,7 @@ func (s *Server) HandleModify(c *gin.Context) { logger.SdmLog.Infof("Handle Modify") - supi := c.Params.ByName("supi") + supi := c.Params.ByName("ueId") subscriptionID := c.Params.ByName("subscriptionId") s.Processor().ModifyProcedure(c, &sdmSubsModificationReq, supi, subscriptionID) @@ -377,7 +377,7 @@ func (s *Server) HandleGetIdTranslationResult(c *gin.Context) { logger.SdmLog.Infof("Handle GetIdTranslationResultRequest") - gpsi := c.Params.ByName("gpsi") + gpsi := c.Params.ByName("ueId") s.Processor().GetIdTranslationResultProcedure(c, gpsi) } @@ -419,7 +419,6 @@ func (s *Server) TwoLayerPathHandlerFunc(c *gin.Context) { // for "/:ueId/id-translation-result" if op == "id-translation-result" && strings.ToUpper("Get") == c.Request.Method { - c.Params = append(c.Params, gin.Param{Key: "ueId", Value: c.Param("supi")}) s.HandleGetIdTranslationResult(c) return } @@ -441,7 +440,6 @@ func (s *Server) ThreeLayerPathHandlerFunc(c *gin.Context) { // for "/:ueId/sdm-subscriptions/:subscriptionId" if op == "sdm-subscriptions" && strings.ToUpper("Delete") == c.Request.Method { var tmpParams gin.Params - tmpParams = append(tmpParams, gin.Param{Key: "ueId", Value: c.Param("supi")}) tmpParams = append(tmpParams, gin.Param{Key: "subscriptionId", Value: c.Param("thirdLayer")}) c.Params = tmpParams s.HandleUnsubscribe(c) @@ -457,7 +455,6 @@ func (s *Server) ThreeLayerPathHandlerFunc(c *gin.Context) { // for "/:ueId/sdm-subscriptions/:subscriptionId" if op == "sdm-subscriptions" && strings.ToUpper("Patch") == c.Request.Method { var tmpParams gin.Params - tmpParams = append(tmpParams, gin.Param{Key: "ueId", Value: c.Param("supi")}) tmpParams = append(tmpParams, gin.Param{Key: "subscriptionId", Value: c.Param("thirdLayer")}) c.Params = tmpParams s.HandleModify(c) diff --git a/internal/sbi/api_ueauthentication.go b/internal/sbi/api_ueauthentication.go index 68b61c5..d44f281 100644 --- a/internal/sbi/api_ueauthentication.go +++ b/internal/sbi/api_ueauthentication.go @@ -103,7 +103,6 @@ func (s *Server) HandleGenerateAuthData(c *gin.Context) { } func (s *Server) GenAuthDataHandlerFunc(c *gin.Context) { - c.Params = append(c.Params, gin.Param{Key: "supiOrSuci", Value: c.Param("supi")}) if strings.ToUpper("Post") == c.Request.Method { s.HandleGenerateAuthData(c) return