go: always defer adding headers
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
surtur 2023-09-10 14:16:57 +02:00
parent 882b7dfd28
commit 4d10510f5b
Signed by: wanderer
SSH Key Fingerprint: SHA256:MdCZyJ2sHLltrLBp0xQO0O1qTW9BT/xl5nXkDvhlMCI
5 changed files with 13 additions and 13 deletions

@ -11,7 +11,7 @@ import (
func ManageAPIKeys() echo.HandlerFunc { func ManageAPIKeys() echo.HandlerFunc {
return func(c echo.Context) error { return func(c echo.Context) error {
addHeaders(c) defer addHeaders(c)
u, ok := c.Get("sessUsr").(moduser.User) u, ok := c.Get("sessUsr").(moduser.User)
if !ok { if !ok {

@ -18,7 +18,7 @@ import (
func ManageUsers() echo.HandlerFunc { func ManageUsers() echo.HandlerFunc {
return func(c echo.Context) error { return func(c echo.Context) error {
addHeaders(c) defer addHeaders(c)
u, ok := c.Get("sessUsr").(moduser.User) u, ok := c.Get("sessUsr").(moduser.User)
if !ok { if !ok {
@ -159,7 +159,7 @@ func ManageUsers() echo.HandlerFunc {
func CreateUser() echo.HandlerFunc { //nolint:gocognit func CreateUser() echo.HandlerFunc { //nolint:gocognit
return func(c echo.Context) error { return func(c echo.Context) error {
addHeaders(c) defer addHeaders(c)
u, ok := c.Get("sessUsr").(moduser.User) u, ok := c.Get("sessUsr").(moduser.User)
if !ok { if !ok {
@ -270,7 +270,7 @@ func CreateUser() echo.HandlerFunc { //nolint:gocognit
func ViewUser() echo.HandlerFunc { func ViewUser() echo.HandlerFunc {
return func(c echo.Context) error { return func(c echo.Context) error {
addHeaders(c) defer addHeaders(c)
u, ok := c.Get("sessUsr").(moduser.User) u, ok := c.Get("sessUsr").(moduser.User)
if !ok { if !ok {
@ -407,7 +407,7 @@ func ViewUser() echo.HandlerFunc {
//nolint:dupl //nolint:dupl
func EditUser() echo.HandlerFunc { func EditUser() echo.HandlerFunc {
return func(c echo.Context) error { return func(c echo.Context) error {
addHeaders(c) defer addHeaders(c)
u, ok := c.Get("sessUsr").(moduser.User) u, ok := c.Get("sessUsr").(moduser.User)
if !ok { if !ok {
@ -509,7 +509,7 @@ func EditUser() echo.HandlerFunc {
//nolint:dupl //nolint:dupl
func UpdateUser() echo.HandlerFunc { //nolint:gocognit func UpdateUser() echo.HandlerFunc { //nolint:gocognit
return func(c echo.Context) error { return func(c echo.Context) error {
addHeaders(c) defer addHeaders(c)
u, ok := c.Get("sessUsr").(moduser.User) u, ok := c.Get("sessUsr").(moduser.User)
if !ok { if !ok {
@ -745,7 +745,7 @@ func UpdateUser() echo.HandlerFunc { //nolint:gocognit
// DeleteUserConfirmation displays user deletion confirmation confirmation page. // DeleteUserConfirmation displays user deletion confirmation confirmation page.
func DeleteUserConfirmation() echo.HandlerFunc { func DeleteUserConfirmation() echo.HandlerFunc {
return func(c echo.Context) error { return func(c echo.Context) error {
addHeaders(c) defer addHeaders(c)
u, ok := c.Get("sessUsr").(moduser.User) u, ok := c.Get("sessUsr").(moduser.User)
if !ok { if !ok {
@ -846,7 +846,7 @@ func DeleteUserConfirmation() echo.HandlerFunc {
// DeleteUser handles user deletion POST requests. // DeleteUser handles user deletion POST requests.
func DeleteUser() echo.HandlerFunc { func DeleteUser() echo.HandlerFunc {
return func(c echo.Context) error { return func(c echo.Context) error {
addHeaders(c) defer addHeaders(c)
u, ok := c.Get("sessUsr").(moduser.User) u, ok := c.Get("sessUsr").(moduser.User)
if !ok { if !ok {

@ -17,7 +17,7 @@ import (
func GetSearchHIBP() echo.HandlerFunc { func GetSearchHIBP() echo.HandlerFunc {
return func(c echo.Context) error { return func(c echo.Context) error {
addHeaders(c) defer addHeaders(c)
u, ok := c.Get("sessUsr").(moduser.User) u, ok := c.Get("sessUsr").(moduser.User)
if !ok { if !ok {
@ -92,7 +92,7 @@ func GetSearchHIBP() echo.HandlerFunc {
func SearchHIBP() echo.HandlerFunc { func SearchHIBP() echo.HandlerFunc {
return func(c echo.Context) error { return func(c echo.Context) error {
addHeaders(c) defer addHeaders(c)
u, ok := c.Get("sessUsr").(moduser.User) u, ok := c.Get("sessUsr").(moduser.User)
if !ok { if !ok {

@ -15,7 +15,7 @@ import (
func InitialPasswordChangePost() echo.HandlerFunc { func InitialPasswordChangePost() echo.HandlerFunc {
return func(c echo.Context) error { return func(c echo.Context) error {
addHeaders(c) defer addHeaders(c)
u, ok := c.Get("sessUsr").(moduser.User) u, ok := c.Get("sessUsr").(moduser.User)
if !ok { if !ok {
@ -136,7 +136,7 @@ func InitialPasswordChangePost() echo.HandlerFunc {
func InitialPasswordChange() echo.HandlerFunc { func InitialPasswordChange() echo.HandlerFunc {
return func(c echo.Context) error { return func(c echo.Context) error {
addHeaders(c) defer addHeaders(c)
u, ok := c.Get("sessUsr").(moduser.User) u, ok := c.Get("sessUsr").(moduser.User)
if !ok { if !ok {

@ -14,7 +14,7 @@ import (
func ViewHIBP() echo.HandlerFunc { func ViewHIBP() echo.HandlerFunc {
return func(c echo.Context) error { return func(c echo.Context) error {
addHeaders(c) defer addHeaders(c)
u, ok := c.Get("sessUsr").(moduser.User) u, ok := c.Get("sessUsr").(moduser.User)
if !ok { if !ok {