Skip to content

Commit

Permalink
fix: represent http method using const instead of strings
Browse files Browse the repository at this point in the history
  • Loading branch information
yccodr committed Sep 10, 2024
1 parent f4eb2e8 commit 74f5caa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
13 changes: 6 additions & 7 deletions internal/sbi/api_nssaiavailability.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package sbi

import (
"net/http"
"strings"

"github.com/gin-gonic/gin"

Expand All @@ -17,7 +16,7 @@ func (s *Server) getNssaiAvailabilityRoutes() []Route {
return []Route{
{
"Health Check",
strings.ToUpper("Get"),
http.MethodGet,
"/",
func(ctx *gin.Context) {
ctx.JSON(http.StatusOK, gin.H{"status": "Service Available"})
Expand All @@ -26,21 +25,21 @@ func (s *Server) getNssaiAvailabilityRoutes() []Route {

{
"NSSAIAvailabilityDelete",
strings.ToUpper("Delete"),
http.MethodDelete,
"/nssai-availability/:nfId",
s.NSSAIAvailabilityDelete,
},

{
"NSSAIAvailabilityPatch",
strings.ToUpper("Patch"),
http.MethodPatch,
"/nssai-availability/:nfId",
s.NSSAIAvailabilityPatch,
},

{
"NSSAIAvailabilityPut",
strings.ToUpper("Put"),
http.MethodPut,
"/nssai-availability/:nfId",
s.NSSAIAvailabilityPut,
},
Expand All @@ -50,15 +49,15 @@ func (s *Server) getNssaiAvailabilityRoutes() []Route {
// Simply replace 'subscriptions' with ':nfId' and check if ':nfId' is 'subscriptions' in handler function
{
"NSSAIAvailabilityUnsubscribe",
strings.ToUpper("Delete"),
http.MethodDelete,
// "/nssai-availability/subscriptions/:subscriptionId",
"/nssai-availability/:nfId/:subscriptionId",
s.NSSAIAvailabilityUnsubscribeDelete,
},

{
"NSSAIAvailabilityPost",
strings.ToUpper("Post"),
http.MethodPost,
"/nssai-availability/subscriptions",
s.NSSAIAvailabilityPost,
},
Expand Down
5 changes: 2 additions & 3 deletions internal/sbi/api_nsselection.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package sbi

import (
"net/http"
"strings"

"github.com/gin-gonic/gin"

Expand All @@ -16,7 +15,7 @@ func (s *Server) getNsSelectionRoutes() []Route {
return []Route{
{
"Health Check",
strings.ToUpper("Get"),
http.MethodGet,
"/",
func(ctx *gin.Context) {
ctx.JSON(http.StatusOK, gin.H{"status": "Service Available"})
Expand All @@ -25,7 +24,7 @@ func (s *Server) getNsSelectionRoutes() []Route {

{
"NSSelectionGet",
strings.ToUpper("Get"),
http.MethodGet,
"/network-slice-information",
s.NetworkSliceInformationGet,
},
Expand Down

0 comments on commit 74f5caa

Please sign in to comment.