Feat(ktm-booking): Initial commit
Some checks failed
ktm-booking-bot/ktm-booking-bot/pipeline/head Something is wrong with the build of this commit
Some checks failed
ktm-booking-bot/ktm-booking-bot/pipeline/head Something is wrong with the build of this commit
This commit is contained in:
24
backend/internal/common/textresponse.go
Normal file
24
backend/internal/common/textresponse.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-chi/render"
|
||||
)
|
||||
|
||||
type TextResponse struct {
|
||||
Status string `json:"status"` // user-level status message
|
||||
Text string `json:"text"` // application-specific error code
|
||||
}
|
||||
|
||||
func (e *TextResponse) Render(w http.ResponseWriter, r *http.Request) error {
|
||||
render.Status(r, http.StatusOK)
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewGenericTextResponse(status string, text string) render.Renderer {
|
||||
return &TextResponse{
|
||||
Status: status,
|
||||
Text: text,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user