func BadRequest(w http.ResponseWriter, msg string) {
	w.WriteHeader(http.StatusBadRequest)
	if msg == "" {
		msg = "Bad Request"
	}
	w.Write([]byte(msg))
}
Writes a bad request response to the client, with an optional message.
package handlers
import (
	"bytes"
	"encoding/base64"
	"fmt"
	"net/http"
	"strings"
)
type userResponseWriter struct {
	http.ResponseWriter
	user     interface{}
	userName string
}
func (this *userResponseWriter) WrappedWriter() http.ResponseWriter {
	return this.ResponseWriter
}
func Unauthorized(w http.ResponseWriter, realm string) {
	w.Header().Set("Www-Authenticate", fmt.Sprintf(`Basic realm="%s"`, realm))
	w.WriteHeader(http.StatusUnauthorized)
	w.Write([]byte("Unauthorized"))
}