Compare commits

..

No commits in common. "fa3165d317b31f4c9ef77258125b4f493a8ef337" and "9670b7d71738ddf956eb51c1d8209cba8187418b" have entirely different histories.

3 changed files with 4 additions and 13 deletions

View File

@ -8,7 +8,6 @@ import (
"GoWeb/routes"
"context"
"embed"
"errors"
"log"
"net/http"
"os"
@ -69,7 +68,7 @@ func main() {
go func() {
log.Println("Starting server and listening on " + appLoaded.Config.Listen.Ip + ":" + appLoaded.Config.Listen.Port)
err := server.ListenAndServe()
if err != nil && !errors.Is(err, http.ErrServerClosed) {
if err != nil && err != http.ErrServerClosed {
log.Fatalf("Could not listen on %s: %v\n", appLoaded.Config.Listen.Ip+":"+appLoaded.Config.Listen.Port, err)
}
}()

View File

@ -6,7 +6,7 @@ import (
"net/http"
)
// Csrf validates the CSRF token and returns the handler function if it succeeded
// Csrf validates the CSRF token and returns the handler function if it succeded
func Csrf(f func(w http.ResponseWriter, r *http.Request)) func(w http.ResponseWriter, r *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
_, err := security.VerifyCsrfToken(r)

View File

@ -21,17 +21,9 @@ func SendRequest(url string, method string, headers map[string]string, body inte
reqBody = &bytes.Buffer{}
writer := multipart.NewWriter(reqBody)
for key, value := range v {
err := writer.WriteField(key, value)
if err != nil {
return http.Response{}, err
writer.WriteField(key, value)
}
}
err := writer.Close()
if err != nil {
return http.Response{}, err
}
writer.Close()
contentType = writer.FormDataContentType()
default:
jsonBody, err := json.Marshal(body)