You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
487 B
24 lines
487 B
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,
|
|
}
|
|
}
|