1
0
forked from wrenn/wrenn

v0.1.4 (#38) — pipeline test

This commit is contained in:
Tasnim Kabir Sadik
2026-05-02 22:41:35 +06:00
parent 4fcc19e91f
commit 892ae7c6b6
27 changed files with 629 additions and 437 deletions

View File

@ -22,6 +22,13 @@ func requireJWT(secret []byte, queries *db.Queries) func(http.Handler) http.Hand
tokenStr = strings.TrimPrefix(header, "Bearer ")
}
if tokenStr == "" {
// WebSocket upgrade requests may not have an Authorization header
// (browsers cannot set custom headers on WS connections). Let them
// through — the handler authenticates via the first WS message.
if isWebSocketUpgrade(r) {
next.ServeHTTP(w, r)
return
}
writeError(w, http.StatusUnauthorized, "unauthorized", "Authorization: Bearer <token> required")
return
}