Close all sessions after using them

This commit is contained in:
kolaente 2020-12-22 17:12:34 +01:00
parent 6fa2fb5872
commit a897a6def6
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
5 changed files with 25 additions and 0 deletions

View File

@ -73,6 +73,11 @@ func (c *WebHandler) CreateWeb(ctx echo.Context) error {
return HandleHTTPError(err, ctx)
}
err = s.Close()
if err != nil {
return HandleHTTPError(err, ctx)
}
err = ctx.JSON(http.StatusCreated, currentStruct)
if err != nil {
return HandleHTTPError(err, ctx)

View File

@ -71,6 +71,11 @@ func (c *WebHandler) DeleteWeb(ctx echo.Context) error {
return HandleHTTPError(err, ctx)
}
err = s.Close()
if err != nil {
return HandleHTTPError(err, ctx)
}
err = ctx.JSON(http.StatusOK, message{"Successfully deleted."})
if err != nil {
return HandleHTTPError(err, ctx)

View File

@ -113,6 +113,11 @@ func (c *WebHandler) ReadAllWeb(ctx echo.Context) error {
return HandleHTTPError(err, ctx)
}
err = s.Close()
if err != nil {
return HandleHTTPError(err, ctx)
}
err = ctx.JSON(http.StatusOK, result)
if err != nil {
return HandleHTTPError(err, ctx)

View File

@ -74,6 +74,11 @@ func (c *WebHandler) ReadOneWeb(ctx echo.Context) error {
return HandleHTTPError(err, ctx)
}
err = s.Close()
if err != nil {
return HandleHTTPError(err, ctx)
}
err = ctx.JSON(http.StatusOK, currentStruct)
if err != nil {
return HandleHTTPError(err, ctx)

View File

@ -73,6 +73,11 @@ func (c *WebHandler) UpdateWeb(ctx echo.Context) error {
return HandleHTTPError(err, ctx)
}
err = s.Close()
if err != nil {
return HandleHTTPError(err, ctx)
}
err = ctx.JSON(http.StatusOK, currentStruct)
if err != nil {
return HandleHTTPError(err, ctx)