pink_fox/pink_fox_app/internal/http_server/http/response.go

24 lines
358 B
Go

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)
}