working sub
This commit is contained in:
@@ -12,6 +12,7 @@ type Error struct {
|
||||
}
|
||||
|
||||
func WriteError(w http.ResponseWriter, err error) {
|
||||
log.Println(err)
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
e := json.NewEncoder(w).Encode(Error{
|
||||
@@ -59,6 +60,7 @@ func ReadBody[T any](r *http.Request) (T, error) {
|
||||
}
|
||||
func CheckToken(r *http.Request) bool {
|
||||
auth := r.Header.Get("Authorization")
|
||||
log.Println(auth)
|
||||
if auth != cfg.JWTSecret {
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user