mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
change error messages punctuation.
This commit is contained in:
parent
4f1e3c879a
commit
ec18775e26
@ -71,12 +71,12 @@ func (h *MembersHandler) membersCreate(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
if data.Username == "" {
|
||||
utils.HttpBadRequest(w, "Username cannot be empty.")
|
||||
utils.HttpBadRequest(w, "username cannot be empty")
|
||||
return
|
||||
}
|
||||
|
||||
if data.Password == "" {
|
||||
utils.HttpBadRequest(w, "Password cannot be empty.")
|
||||
utils.HttpBadRequest(w, "password cannot be empty")
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -28,13 +28,13 @@ func (h *RoomHandler) boradcastStart(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
if data.URL == "" {
|
||||
utils.HttpBadRequest(w, "Missing broadcast URL.")
|
||||
utils.HttpBadRequest(w, "missing broadcast URL")
|
||||
return
|
||||
}
|
||||
|
||||
broadcast := h.capture.Broadcast()
|
||||
if broadcast.Started() {
|
||||
utils.HttpUnprocessableEntity(w, "Server is already broadcasting.")
|
||||
utils.HttpUnprocessableEntity(w, "server is already broadcasting")
|
||||
return
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ func (h *RoomHandler) boradcastStart(w http.ResponseWriter, r *http.Request) {
|
||||
func (h *RoomHandler) boradcastStop(w http.ResponseWriter, r *http.Request) {
|
||||
broadcast := h.capture.Broadcast()
|
||||
if !broadcast.Started() {
|
||||
utils.HttpUnprocessableEntity(w, "Server is not broadcasting.")
|
||||
utils.HttpUnprocessableEntity(w, "server is not broadcasting")
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ func (h *RoomHandler) clipboardGetImage(w http.ResponseWriter, r *http.Request)
|
||||
func (h *RoomHandler) clipboardSetImage(w http.ResponseWriter, r *http.Request) {
|
||||
err := r.ParseMultipartForm(MAX_UPLOAD_SIZE)
|
||||
if err != nil {
|
||||
utils.HttpBadRequest(w, "Failed to parse multipart form.")
|
||||
utils.HttpBadRequest(w, "failed to parse multipart form")
|
||||
return
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@ func (h *RoomHandler) clipboardSetImage(w http.ResponseWriter, r *http.Request)
|
||||
|
||||
file, header, err := r.FormFile("file")
|
||||
if err != nil {
|
||||
utils.HttpBadRequest(w, "No file received.")
|
||||
utils.HttpBadRequest(w, "no file received")
|
||||
return
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ func (h *RoomHandler) clipboardSetImage(w http.ResponseWriter, r *http.Request)
|
||||
|
||||
mime := header.Header.Get("Content-Type")
|
||||
if !strings.HasPrefix(mime, "image/") {
|
||||
utils.HttpBadRequest(w, "File must be image.")
|
||||
utils.HttpBadRequest(w, "file must be image")
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ func (h *RoomHandler) controlStatus(w http.ResponseWriter, r *http.Request) {
|
||||
func (h *RoomHandler) controlRequest(w http.ResponseWriter, r *http.Request) {
|
||||
host := h.sessions.GetHost()
|
||||
if host != nil {
|
||||
utils.HttpUnprocessableEntity(w, "There is already a host.")
|
||||
utils.HttpUnprocessableEntity(w, "there is already a host")
|
||||
return
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ func (h *RoomHandler) controlRequest(w http.ResponseWriter, r *http.Request) {
|
||||
func (h *RoomHandler) controlRelease(w http.ResponseWriter, r *http.Request) {
|
||||
session := auth.GetSession(r)
|
||||
if !session.IsHost() {
|
||||
utils.HttpUnprocessableEntity(w, "Session is not the host.")
|
||||
utils.HttpUnprocessableEntity(w, "session is not the host")
|
||||
return
|
||||
}
|
||||
|
||||
@ -71,12 +71,12 @@ func (h *RoomHandler) controlGive(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
target, ok := h.sessions.Get(sessionId)
|
||||
if !ok {
|
||||
utils.HttpNotFound(w, "Target session was not found.")
|
||||
utils.HttpNotFound(w, "target session was not found")
|
||||
return
|
||||
}
|
||||
|
||||
if !target.Profile().CanHost {
|
||||
utils.HttpBadRequest(w, "Target session is not allowed to host.")
|
||||
utils.HttpBadRequest(w, "target session is not allowed to host")
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ func (h *RoomHandler) uploadMiddleware(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
session := auth.GetSession(r)
|
||||
if !session.IsHost() && (!session.Profile().CanHost || !h.sessions.ImplicitHosting()) {
|
||||
utils.HttpForbidden(w, "Without implicit hosting, only host can upload files.")
|
||||
utils.HttpForbidden(w, "without implicit hosting, only host can upload files")
|
||||
} else {
|
||||
next.ServeHTTP(w, r)
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ func (h *RoomHandler) keyboardMapSet(w http.ResponseWriter, r *http.Request) {
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
utils.HttpInternalServerError(w, "Unable to change keyboard map.")
|
||||
utils.HttpInternalServerError(w, "unable to change keyboard map")
|
||||
return
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ func (h *RoomHandler) keyboardMapGet(w http.ResponseWriter, r *http.Request) {
|
||||
data, err := h.desktop.GetKeyboardMap()
|
||||
|
||||
if err != nil {
|
||||
utils.HttpInternalServerError(w, "Unable to get keyboard map.")
|
||||
utils.HttpInternalServerError(w, "unable to get keyboard map")
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ func (h *RoomHandler) screenConfiguration(w http.ResponseWriter, r *http.Request
|
||||
size := h.desktop.GetScreenSize()
|
||||
|
||||
if size == nil {
|
||||
utils.HttpInternalServerError(w, "Unable to get screen configuration.")
|
||||
utils.HttpInternalServerError(w, "unable to get screen configuration")
|
||||
return
|
||||
}
|
||||
|
||||
@ -96,7 +96,7 @@ func (h *RoomHandler) screenShotGet(w http.ResponseWriter, r *http.Request) {
|
||||
func (h *RoomHandler) screenCastGet(w http.ResponseWriter, r *http.Request) {
|
||||
screencast := h.capture.Screencast()
|
||||
if !screencast.Enabled() {
|
||||
utils.HttpBadRequest(w, "Screencast pipeline is not enabled.")
|
||||
utils.HttpBadRequest(w, "screencast pipeline is not enabled")
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ const (
|
||||
func (h *RoomHandler) uploadDrop(w http.ResponseWriter, r *http.Request) {
|
||||
err := r.ParseMultipartForm(MAX_UPLOAD_SIZE)
|
||||
if err != nil {
|
||||
utils.HttpBadRequest(w, "Failed to parse multipart form.")
|
||||
utils.HttpBadRequest(w, "failed to parse multipart form")
|
||||
return
|
||||
}
|
||||
|
||||
@ -28,19 +28,19 @@ func (h *RoomHandler) uploadDrop(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
X, err := strconv.Atoi(r.FormValue("x"))
|
||||
if err != nil {
|
||||
utils.HttpBadRequest(w, "No X coordinate received.")
|
||||
utils.HttpBadRequest(w, "no X coordinate received")
|
||||
return
|
||||
}
|
||||
|
||||
Y, err := strconv.Atoi(r.FormValue("y"))
|
||||
if err != nil {
|
||||
utils.HttpBadRequest(w, "No Y coordinate received.")
|
||||
utils.HttpBadRequest(w, "no Y coordinate received")
|
||||
return
|
||||
}
|
||||
|
||||
req_files := r.MultipartForm.File["files"]
|
||||
if len(req_files) == 0 {
|
||||
utils.HttpBadRequest(w, "No files received.")
|
||||
utils.HttpBadRequest(w, "no files received")
|
||||
return
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ func (h *RoomHandler) uploadDrop(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
if !h.desktop.DropFiles(X, Y, files) {
|
||||
utils.HttpInternalServerError(w, "Unable to drop files.")
|
||||
utils.HttpInternalServerError(w, "unable to drop files")
|
||||
return
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ func (h *RoomHandler) uploadDrop(w http.ResponseWriter, r *http.Request) {
|
||||
func (h *RoomHandler) uploadDialogPost(w http.ResponseWriter, r *http.Request) {
|
||||
err := r.ParseMultipartForm(MAX_UPLOAD_SIZE)
|
||||
if err != nil {
|
||||
utils.HttpBadRequest(w, "Failed to parse multipart form.")
|
||||
utils.HttpBadRequest(w, "failed to parse multipart form")
|
||||
return
|
||||
}
|
||||
|
||||
@ -98,13 +98,13 @@ func (h *RoomHandler) uploadDialogPost(w http.ResponseWriter, r *http.Request) {
|
||||
defer r.MultipartForm.RemoveAll()
|
||||
|
||||
if !h.desktop.IsFileChooserDialogOpened() {
|
||||
utils.HttpBadRequest(w, "Open file chooser dialog first.")
|
||||
utils.HttpBadRequest(w, "open file chooser dialog first")
|
||||
return
|
||||
}
|
||||
|
||||
req_files := r.MultipartForm.File["files"]
|
||||
if len(req_files) == 0 {
|
||||
utils.HttpBadRequest(w, "No files received.")
|
||||
utils.HttpBadRequest(w, "no files received")
|
||||
return
|
||||
}
|
||||
|
||||
@ -141,7 +141,7 @@ func (h *RoomHandler) uploadDialogPost(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
if err := h.desktop.HandleFileChooserDialog(dir); err != nil {
|
||||
utils.HttpInternalServerError(w, "Unable to handle file chooser dialog.")
|
||||
utils.HttpInternalServerError(w, "unable to handle file chooser dialog")
|
||||
return
|
||||
}
|
||||
|
||||
@ -150,7 +150,7 @@ func (h *RoomHandler) uploadDialogPost(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
func (h *RoomHandler) uploadDialogClose(w http.ResponseWriter, r *http.Request) {
|
||||
if !h.desktop.IsFileChooserDialogOpened() {
|
||||
utils.HttpBadRequest(w, "File chooser dialog is not open.")
|
||||
utils.HttpBadRequest(w, "file chooser dialog is not open")
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@ func ChangeScreenSize(width int, height int, rate int16) error {
|
||||
}
|
||||
}
|
||||
|
||||
return fmt.Errorf("Unknown screen configuration %dx%d@%d.", width, height, rate)
|
||||
return fmt.Errorf("unknown screen configuration %dx%d@%d", width, height, rate)
|
||||
}
|
||||
|
||||
func GetScreenSize() *types.ScreenSize {
|
||||
|
@ -27,7 +27,7 @@ func AdminsOnly(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
session := GetSession(r)
|
||||
if !session.Profile().IsAdmin {
|
||||
utils.HttpForbidden(w, "Only admin can do this.")
|
||||
utils.HttpForbidden(w)
|
||||
} else {
|
||||
next.ServeHTTP(w, r)
|
||||
}
|
||||
@ -38,7 +38,7 @@ func HostsOnly(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
session := GetSession(r)
|
||||
if !session.IsHost() {
|
||||
utils.HttpForbidden(w, "Only host can do this.")
|
||||
utils.HttpForbidden(w, "only host can do this")
|
||||
} else {
|
||||
next.ServeHTTP(w, r)
|
||||
}
|
||||
@ -49,7 +49,7 @@ func CanWatchOnly(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
session := GetSession(r)
|
||||
if !session.Profile().CanWatch {
|
||||
utils.HttpForbidden(w, "Only sessions, that can watch.")
|
||||
utils.HttpForbidden(w)
|
||||
} else {
|
||||
next.ServeHTTP(w, r)
|
||||
}
|
||||
@ -60,7 +60,7 @@ func CanHostOnly(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
session := GetSession(r)
|
||||
if !session.Profile().CanHost {
|
||||
utils.HttpForbidden(w, "Only sessions, that can host.")
|
||||
utils.HttpForbidden(w)
|
||||
} else {
|
||||
next.ServeHTTP(w, r)
|
||||
}
|
||||
@ -71,7 +71,7 @@ func CanAccessClipboardOnly(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
session := GetSession(r)
|
||||
if !session.Profile().CanAccessClipboard {
|
||||
utils.HttpForbidden(w, "Only sessions, that can access clipboard.")
|
||||
utils.HttpForbidden(w)
|
||||
} else {
|
||||
next.ServeHTTP(w, r)
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ func (provider *MemberProviderCtx) Authenticate(username string, password string
|
||||
}
|
||||
|
||||
func (provider *MemberProviderCtx) Insert(username string, password string, profile types.MemberProfile) (string, error) {
|
||||
return "", fmt.Errorf("Not implemented.")
|
||||
return "", fmt.Errorf("not implemented")
|
||||
}
|
||||
|
||||
func (provider *MemberProviderCtx) Select(id string) (types.MemberProfile, error) {
|
||||
@ -54,7 +54,7 @@ func (provider *MemberProviderCtx) UpdateProfile(id string, profile types.Member
|
||||
}
|
||||
|
||||
func (provider *MemberProviderCtx) UpdatePassword(id string, password string) error {
|
||||
return fmt.Errorf("Not implemented.")
|
||||
return fmt.Errorf("not implemented")
|
||||
}
|
||||
|
||||
func (provider *MemberProviderCtx) Delete(id string) error {
|
||||
|
@ -38,7 +38,7 @@ func (provider *MemberProviderCtx) Authenticate(username string, password string
|
||||
|
||||
// TODO: Use hash function.
|
||||
if entry.Password != password {
|
||||
return "", types.MemberProfile{}, fmt.Errorf("Invalid password.")
|
||||
return "", types.MemberProfile{}, fmt.Errorf("invalid password")
|
||||
}
|
||||
|
||||
return id, entry.Profile, nil
|
||||
@ -55,7 +55,7 @@ func (provider *MemberProviderCtx) Insert(username string, password string, prof
|
||||
|
||||
_, ok := entries[id]
|
||||
if ok {
|
||||
return "", fmt.Errorf("Member ID already exists.")
|
||||
return "", fmt.Errorf("member ID already exists")
|
||||
}
|
||||
|
||||
entries[id] = MemberEntry{
|
||||
@ -75,7 +75,7 @@ func (provider *MemberProviderCtx) UpdateProfile(id string, profile types.Member
|
||||
|
||||
entry, ok := entries[id]
|
||||
if !ok {
|
||||
return fmt.Errorf("Member ID does not exist.")
|
||||
return fmt.Errorf("member ID does not exist")
|
||||
}
|
||||
|
||||
entry.Profile = profile
|
||||
@ -92,7 +92,7 @@ func (provider *MemberProviderCtx) UpdatePassword(id string, password string) er
|
||||
|
||||
entry, ok := entries[id]
|
||||
if !ok {
|
||||
return fmt.Errorf("Member ID does not exist.")
|
||||
return fmt.Errorf("member ID does not exist")
|
||||
}
|
||||
|
||||
// TODO: Use hash function.
|
||||
@ -139,7 +139,7 @@ func (provider *MemberProviderCtx) Delete(id string) error {
|
||||
|
||||
_, ok := entries[id]
|
||||
if !ok {
|
||||
return fmt.Errorf("Member ID does not exist.")
|
||||
return fmt.Errorf("member ID does not exist")
|
||||
}
|
||||
|
||||
delete(entries, id)
|
||||
@ -178,7 +178,7 @@ func (provider *MemberProviderCtx) getEntry(id string) (MemberEntry, error) {
|
||||
|
||||
entry, ok := entries[id]
|
||||
if !ok {
|
||||
return MemberEntry{}, fmt.Errorf("Member ID does not exist.")
|
||||
return MemberEntry{}, fmt.Errorf("member ID does not exist")
|
||||
}
|
||||
|
||||
return entry, nil
|
||||
|
@ -60,12 +60,12 @@ func (provider *MemberProviderCtx) Authenticate(username string, password string
|
||||
|
||||
entry, ok := provider.entries[id]
|
||||
if !ok {
|
||||
return "", types.MemberProfile{}, fmt.Errorf("Member ID does not exist.")
|
||||
return "", types.MemberProfile{}, fmt.Errorf("member ID does not exist")
|
||||
}
|
||||
|
||||
// TODO: Use hash function.
|
||||
if entry.Password != password {
|
||||
return "", types.MemberProfile{}, fmt.Errorf("Invalid password.")
|
||||
return "", types.MemberProfile{}, fmt.Errorf("invalid password")
|
||||
}
|
||||
|
||||
return id, entry.Profile, nil
|
||||
@ -77,7 +77,7 @@ func (provider *MemberProviderCtx) Insert(username string, password string, prof
|
||||
|
||||
_, ok := provider.entries[id]
|
||||
if ok {
|
||||
return "", fmt.Errorf("Member ID already exists.")
|
||||
return "", fmt.Errorf("member ID already exists")
|
||||
}
|
||||
|
||||
provider.entries[id] = &MemberEntry{
|
||||
@ -92,7 +92,7 @@ func (provider *MemberProviderCtx) Insert(username string, password string, prof
|
||||
func (provider *MemberProviderCtx) UpdateProfile(id string, profile types.MemberProfile) error {
|
||||
entry, ok := provider.entries[id]
|
||||
if !ok {
|
||||
return fmt.Errorf("Member ID does not exist.")
|
||||
return fmt.Errorf("member ID does not exist")
|
||||
}
|
||||
|
||||
entry.Profile = profile
|
||||
@ -103,7 +103,7 @@ func (provider *MemberProviderCtx) UpdateProfile(id string, profile types.Member
|
||||
func (provider *MemberProviderCtx) UpdatePassword(id string, password string) error {
|
||||
entry, ok := provider.entries[id]
|
||||
if !ok {
|
||||
return fmt.Errorf("Member ID does not exist.")
|
||||
return fmt.Errorf("member ID does not exist")
|
||||
}
|
||||
|
||||
// TODO: Use hash function.
|
||||
@ -115,7 +115,7 @@ func (provider *MemberProviderCtx) UpdatePassword(id string, password string) er
|
||||
func (provider *MemberProviderCtx) Select(id string) (types.MemberProfile, error) {
|
||||
entry, ok := provider.entries[id]
|
||||
if !ok {
|
||||
return types.MemberProfile{}, fmt.Errorf("Member ID does not exist.")
|
||||
return types.MemberProfile{}, fmt.Errorf("member ID does not exist")
|
||||
}
|
||||
|
||||
return entry.Profile, nil
|
||||
@ -139,7 +139,7 @@ func (provider *MemberProviderCtx) SelectAll(limit int, offset int) (map[string]
|
||||
func (provider *MemberProviderCtx) Delete(id string) error {
|
||||
_, ok := provider.entries[id]
|
||||
if !ok {
|
||||
return fmt.Errorf("Member ID does not exist.")
|
||||
return fmt.Errorf("member ID does not exist")
|
||||
}
|
||||
|
||||
delete(provider.entries, id)
|
||||
|
@ -68,12 +68,12 @@ func (manager *SessionManagerCtx) Create(id string, profile types.MemberProfile)
|
||||
manager.sessionsMu.Lock()
|
||||
if _, ok := manager.sessions[id]; ok {
|
||||
manager.sessionsMu.Unlock()
|
||||
return nil, "", fmt.Errorf("Session id already exists.")
|
||||
return nil, "", fmt.Errorf("session id already exists")
|
||||
}
|
||||
|
||||
if _, ok := manager.tokens[token]; ok {
|
||||
manager.sessionsMu.Unlock()
|
||||
return nil, "", fmt.Errorf("Session token already exists.")
|
||||
return nil, "", fmt.Errorf("session token already exists")
|
||||
}
|
||||
|
||||
session := &SessionCtx{
|
||||
@ -98,7 +98,7 @@ func (manager *SessionManagerCtx) Update(id string, profile types.MemberProfile)
|
||||
session, ok := manager.sessions[id]
|
||||
if !ok {
|
||||
manager.sessionsMu.Unlock()
|
||||
return fmt.Errorf("Session id not found.")
|
||||
return fmt.Errorf("session id not found")
|
||||
}
|
||||
|
||||
session.profile = profile
|
||||
@ -114,7 +114,7 @@ func (manager *SessionManagerCtx) Delete(id string) error {
|
||||
session, ok := manager.sessions[id]
|
||||
if !ok {
|
||||
manager.sessionsMu.Unlock()
|
||||
return fmt.Errorf("Session id not found.")
|
||||
return fmt.Errorf("session id not found")
|
||||
}
|
||||
|
||||
delete(manager.tokens, session.token)
|
||||
|
@ -16,7 +16,7 @@ type ErrResponse struct {
|
||||
func HttpJsonRequest(w http.ResponseWriter, r *http.Request, res interface{}) bool {
|
||||
if err := json.NewDecoder(r.Body).Decode(res); err != nil {
|
||||
if err == io.EOF {
|
||||
HttpBadRequest(w, "No data provided.")
|
||||
HttpBadRequest(w, "no data provided")
|
||||
} else {
|
||||
HttpBadRequest(w, err)
|
||||
}
|
||||
@ -53,27 +53,27 @@ func HttpSuccess(w http.ResponseWriter, res ...interface{}) {
|
||||
}
|
||||
|
||||
func HttpBadRequest(w http.ResponseWriter, res ...interface{}) {
|
||||
defHttpError(w, http.StatusBadRequest, "Bad Request.", res...)
|
||||
defHttpError(w, http.StatusBadRequest, "bad request", res...)
|
||||
}
|
||||
|
||||
func HttpUnauthorized(w http.ResponseWriter, res ...interface{}) {
|
||||
defHttpError(w, http.StatusUnauthorized, "Invalid or missing access token.", res...)
|
||||
defHttpError(w, http.StatusUnauthorized, "invalid or missing access token", res...)
|
||||
}
|
||||
|
||||
func HttpForbidden(w http.ResponseWriter, res ...interface{}) {
|
||||
defHttpError(w, http.StatusForbidden, "Access token does not have the required scope.", res...)
|
||||
defHttpError(w, http.StatusForbidden, "access token does not have the required scope", res...)
|
||||
}
|
||||
|
||||
func HttpNotFound(w http.ResponseWriter, res ...interface{}) {
|
||||
defHttpError(w, http.StatusNotFound, "Resource not found.", res...)
|
||||
defHttpError(w, http.StatusNotFound, "resource not found", res...)
|
||||
}
|
||||
|
||||
func HttpUnprocessableEntity(w http.ResponseWriter, res ...interface{}) {
|
||||
defHttpError(w, http.StatusUnprocessableEntity, "Unprocessable Entity.", res...)
|
||||
defHttpError(w, http.StatusUnprocessableEntity, "unprocessable entity", res...)
|
||||
}
|
||||
|
||||
func HttpInternalServerError(w http.ResponseWriter, res ...interface{}) {
|
||||
defHttpError(w, http.StatusInternalServerError, "Internal server error.", res...)
|
||||
defHttpError(w, http.StatusInternalServerError, "internal server error", res...)
|
||||
}
|
||||
|
||||
func defHttpError(w http.ResponseWriter, status int, text string, res ...interface{}) {
|
||||
|
Loading…
Reference in New Issue
Block a user