working commit
This commit is contained in:
@@ -57,16 +57,19 @@ func (rctx *Context) SetStatus(httpStatus int) {
|
||||
rctx.Writer.WriteHeader(httpStatus)
|
||||
}
|
||||
|
||||
func (rctx *Context) SendJSON(payload any) {
|
||||
func (rctx *Context) SendJSON(statusCode int, payload any) {
|
||||
rctx.Writer.Header().Set("Content-Type", "application/json")
|
||||
rctx.Writer.WriteHeader(statusCode)
|
||||
json.NewEncoder(rctx.Writer).Encode(payload)
|
||||
}
|
||||
|
||||
func (rctx *Context) SendText(payload string) {
|
||||
func (rctx *Context) SendText(statusCode int, payload string) {
|
||||
rctx.Writer.Header().Set("Content-Type", "text/plain")
|
||||
rctx.Writer.WriteHeader(statusCode)
|
||||
rctx.Writer.Write([]byte(payload))
|
||||
}
|
||||
|
||||
func (rctx *Context) SendBytes(payload []byte) {
|
||||
func (rctx *Context) SendBytes(statusCode int, payload []byte) {
|
||||
rctx.Writer.WriteHeader(statusCode)
|
||||
rctx.Writer.Write(payload)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user