violet/utils/response.go

12 lines
263 B
Go
Raw Permalink Normal View History

2023-04-21 03:21:46 +01:00
package utils
import (
"fmt"
"net/http"
)
// RespondHttpStatus outputs the status code and text using http.Error()
2023-04-21 03:21:46 +01:00
func RespondHttpStatus(rw http.ResponseWriter, status int) {
http.Error(rw, fmt.Sprintf("%d %s\n", status, http.StatusText(status)), status)
}