package http import ( "github.com/gin-gonic/gin" "net/http" ) type Response interface { Render() } type StringResponse struct { str string ctx *gin.Context } func NewStringResponse(s string, ctx *gin.Context) *StringResponse { return &StringResponse{str: s, ctx: ctx} } func (it *StringResponse) Render() { it.ctx.String(http.StatusOK, it.str) }