fix(web): fix authorization handling

This commit is contained in:
Masahiko AMANO 2023-02-13 18:11:20 +03:00
parent cc55219e46
commit c9dc59ecec

View File

@ -6,6 +6,7 @@ import (
"encoding/json"
"errors"
"fmt"
"io"
"log"
"net/http"
"net/url"
@ -92,7 +93,7 @@ func HandlerAuth(w http.ResponseWriter, r *http.Request) {
log.Fatalf("Failed to close password file: %s\n", err)
}
_, err = r.Body.Read(buffer)
if err != nil {
if err != nil && err != io.EOF {
http.Error(w, err.Error(), http.StatusBadRequest)
defer log.Println("Bad authorization request")
return