Send WWW-Authenticate along with 401 for RFC 7235 conformity
This commit is contained in:
@@ -148,6 +148,7 @@ func main() {
|
||||
http.HandleFunc("/departures", func(w http.ResponseWriter, r *http.Request) {
|
||||
user, pass, ok := r.BasicAuth()
|
||||
if !(ok && user == "admin" && pass == password) {
|
||||
w.Header().Set("WWW-Authenticate", "Basic realm=\"Access to departure API\"")
|
||||
http.Error(w, "You shall not pass", http.StatusUnauthorized)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user