forked from mtusi2026/mtusi2026lab2
fix: address lab2 review feedback
This commit is contained in:
@@ -53,6 +53,11 @@ func (h *SessionHandler) Create(w http.ResponseWriter, r *http.Request) {
|
||||
`Basic realm="messenger", charset="UTF-8"`,
|
||||
)
|
||||
|
||||
if err := requireEmptyBody(r); err != nil {
|
||||
writeError(w, r, http.StatusBadRequest, "invalid_request", "request body must be empty")
|
||||
return
|
||||
}
|
||||
|
||||
username, password, ok := r.BasicAuth()
|
||||
if !ok || username == "" || password == "" {
|
||||
writeError(w, r, http.StatusUnauthorized,
|
||||
|
||||
Reference in New Issue
Block a user