@@ -51,7 +51,7 @@ func (m *middleware) apiKeyAuth(next http.Handler) http.Handler {
5151 slog .String ("user_agent" , r .UserAgent ()),
5252 slog .Any ("error" , err ),
5353 )
54- Unauthorized ( w , r )
54+ sendUnauthorizedResponse ( w )
5555 return
5656 }
5757
@@ -62,7 +62,7 @@ func (m *middleware) apiKeyAuth(next http.Handler) http.Handler {
6262 slog .String ("client_ip" , clientIP ),
6363 slog .String ("user_agent" , r .UserAgent ()),
6464 )
65- Unauthorized ( w , r )
65+ sendUnauthorizedResponse ( w )
6666 return
6767 }
6868 } else {
@@ -74,7 +74,7 @@ func (m *middleware) apiKeyAuth(next http.Handler) http.Handler {
7474 slog .String ("client_ip" , clientIP ),
7575 slog .String ("user_agent" , r .UserAgent ()),
7676 )
77- Unauthorized ( w , r )
77+ sendUnauthorizedResponse ( w )
7878 return
7979 }
8080 fields := strings .Fields (authorization )
@@ -84,7 +84,7 @@ func (m *middleware) apiKeyAuth(next http.Handler) http.Handler {
8484 slog .String ("client_ip" , clientIP ),
8585 slog .String ("user_agent" , r .UserAgent ()),
8686 )
87- Unauthorized ( w , r )
87+ sendUnauthorizedResponse ( w )
8888 return
8989 }
9090 if fields [0 ] != "GoogleLogin" {
@@ -93,7 +93,7 @@ func (m *middleware) apiKeyAuth(next http.Handler) http.Handler {
9393 slog .String ("client_ip" , clientIP ),
9494 slog .String ("user_agent" , r .UserAgent ()),
9595 )
96- Unauthorized ( w , r )
96+ sendUnauthorizedResponse ( w )
9797 return
9898 }
9999 auths := strings .Split (fields [1 ], "=" )
@@ -103,7 +103,7 @@ func (m *middleware) apiKeyAuth(next http.Handler) http.Handler {
103103 slog .String ("client_ip" , clientIP ),
104104 slog .String ("user_agent" , r .UserAgent ()),
105105 )
106- Unauthorized ( w , r )
106+ sendUnauthorizedResponse ( w )
107107 return
108108 }
109109 if auths [0 ] != "auth" {
@@ -112,7 +112,7 @@ func (m *middleware) apiKeyAuth(next http.Handler) http.Handler {
112112 slog .String ("client_ip" , clientIP ),
113113 slog .String ("user_agent" , r .UserAgent ()),
114114 )
115- Unauthorized ( w , r )
115+ sendUnauthorizedResponse ( w )
116116 return
117117 }
118118 token = auths [1 ]
@@ -126,7 +126,7 @@ func (m *middleware) apiKeyAuth(next http.Handler) http.Handler {
126126 slog .String ("user_agent" , r .UserAgent ()),
127127 slog .String ("token" , token ),
128128 )
129- Unauthorized ( w , r )
129+ sendUnauthorizedResponse ( w )
130130 return
131131 }
132132 var integration * model.Integration
@@ -139,7 +139,7 @@ func (m *middleware) apiKeyAuth(next http.Handler) http.Handler {
139139 slog .String ("user_agent" , r .UserAgent ()),
140140 slog .Any ("error" , err ),
141141 )
142- Unauthorized ( w , r )
142+ sendUnauthorizedResponse ( w )
143143 return
144144 }
145145 expectedToken := getAuthToken (integration .GoogleReaderUsername , integration .GoogleReaderPassword )
@@ -149,7 +149,7 @@ func (m *middleware) apiKeyAuth(next http.Handler) http.Handler {
149149 slog .String ("client_ip" , clientIP ),
150150 slog .String ("user_agent" , r .UserAgent ()),
151151 )
152- Unauthorized ( w , r )
152+ sendUnauthorizedResponse ( w )
153153 return
154154 }
155155 if user , err = m .store .UserByID (integration .UserID ); err != nil {
@@ -159,7 +159,7 @@ func (m *middleware) apiKeyAuth(next http.Handler) http.Handler {
159159 slog .String ("user_agent" , r .UserAgent ()),
160160 slog .Any ("error" , err ),
161161 )
162- Unauthorized ( w , r )
162+ sendUnauthorizedResponse ( w )
163163 return
164164 }
165165
@@ -169,7 +169,7 @@ func (m *middleware) apiKeyAuth(next http.Handler) http.Handler {
169169 slog .String ("client_ip" , clientIP ),
170170 slog .String ("user_agent" , r .UserAgent ()),
171171 )
172- Unauthorized ( w , r )
172+ sendUnauthorizedResponse ( w )
173173 return
174174 }
175175
0 commit comments