fix(auth): update test

This commit is contained in:
AJ ONeal 2026-03-03 00:01:15 -07:00
parent 92f865912a
commit 8842791e34
No known key found for this signature in database

View File

@ -20,8 +20,7 @@ func (exampleCredentialStore) Authenticate(username, password string) (auth.Basi
// Set the WWW-Authenticate header before writing a 401 to instruct the browser
// to prompt for Username and Password on failure.
func ExampleBasicRequestAuthenticator() {
ra := auth.NewBasicRequestAuthenticator()
ra.Authenticator = exampleCredentialStore{} // swap in your real credential store
ra := auth.NewBasicRequestAuthenticator(exampleCredentialStore{})
http.HandleFunc("/api/", func(w http.ResponseWriter, r *http.Request) {
principle, err := ra.Authenticate(r)
@ -30,6 +29,6 @@ func ExampleBasicRequestAuthenticator() {
http.Error(w, "Unauthorized", http.StatusUnauthorized)
return
}
fmt.Fprintf(w, "hello %s", principle.ID())
_, _ = fmt.Fprintf(w, "hello %s", principle.ID())
})
}