Revert "chore: debug playwright shutdown errors (#15456)"

This reverts commit f2267082d9.
This commit is contained in:
Michael Geers 2024-08-17 23:33:52 +02:00
parent f2267082d9
commit 07f54e878e
2 changed files with 4 additions and 11 deletions

View file

@ -2,7 +2,6 @@ package server
import (
"encoding/json"
"fmt"
"net/http"
"strings"
"time"
@ -98,7 +97,6 @@ func loginHandler(auth auth.Auth) http.HandlerFunc {
}
if !auth.IsAdminPasswordValid(req.Password) {
fmt.Println("auth: invalid password", req.Password)
http.Error(w, "Invalid password", http.StatusUnauthorized)
return
}
@ -135,7 +133,6 @@ func ensureAuthHandler(auth auth.Auth) mux.MiddlewareFunc {
// check jwt token
ok, err := auth.ValidateJwtToken(jwtFromRequest(r))
if !ok || err != nil {
fmt.Println("auth: invalid auth token", jwtFromRequest(r))
http.Error(w, "Unauthorized", http.StatusUnauthorized)
return
}

View file

@ -88,14 +88,10 @@ async function _stop(instance) {
}
const port = workerPort();
console.log("shutting down evcc", { port });
try {
const res = await axios.post(`${baseUrl()}/api/auth/login`, { password: "secret" });
console.log(res.status, res.statusText);
const cookie = res.headers["set-cookie"];
await axios.post(`${baseUrl()}/api/system/shutdown`, {}, { headers: { cookie } });
} catch (err) {
console.error(err);
}
const res = await axios.post(`${baseUrl()}/api/auth/login`, { password: "secret" });
console.log(res.status, res.statusText);
const cookie = res.headers["set-cookie"];
await axios.post(`${baseUrl()}/api/system/shutdown`, {}, { headers: { cookie } });
console.log(`wait until port ${port} is closed`);
await waitOn({ resources: [`tcp:localhost:${port}`], reverse: true });
console.log("evcc is down", { port });