Skip to content

Commit

Permalink
More Optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
강보원 authored and 강보원 committed Jan 20, 2025
1 parent 40e280a commit 263e7ed
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
2 changes: 2 additions & 0 deletions internal/handler/korcen.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// internal/handler/korcen.go

package handler

import (
Expand Down
20 changes: 16 additions & 4 deletions internal/handler/respond.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
// internal/handler/respond.go

package handler

import "github.com/gin-gonic/gin"
import (
"github.com/gin-gonic/gin"
)

type ResponseType int

const (
JSON ResponseType = iota
XML
)

func respond(c *gin.Context, status int, isXML bool, payload interface{}) {
if isXML {
func respond(c *gin.Context, status int, responseType ResponseType, payload interface{}) {
switch responseType {
case XML:
c.XML(status, payload)
} else {
default:
c.JSON(status, payload)
}
}

0 comments on commit 263e7ed

Please sign in to comment.