i need to send a page with error, s.Error does it, but URL in the browser becomes /api/issue_token instead of whatever URL was before.
// IssueToken is called on POST /api/issue_token by <form> tag
func (s *Server) IssueToken(w http.ResponseWriter, r *http.Request) {
err := r.ParseForm()
if err != nil {
s.Error(w, r, err)
return
}
l, err := s.registrar.Login(r.Context(), ®istrar.LoginUserRequest{
Username: r.Form.Get("username"),
Password: r.Form.Get("password"),
})
if err != nil {
s.Error(w, r, err)
return
}
http.SetCookie(w, &http.Cookie{
Name: "jwt",
Value: l.Token,
Path: "/",
})
http.Redirect(w, r, "/feed", http.StatusFound)
}
html which performs the request
<form action="/api/issue_token" method="POST">...
i need to change my handler or <form> somehow, i am not sure how. i could redirect use to a GET /error for example, but i don't want it