Skip to content

Commit 92eb583

Browse files
Merge pull request #6805 from devtron-labs/release-candidate-v0.42.0
sync: Release candidate v0.42.0
2 parents c00a136 + 314f43a commit 92eb583

File tree

172 files changed

+18845
-875
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

172 files changed

+18845
-875
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
.env
55
/cmd/external-app/devtron-ea
66
devtron
7-
7+
/tests/api-spec-validation/bin
8+
/tests/api-spec-validation/reports
89
.qodo

api/apiToken/ApiTokenRestHandler.go

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ package apiToken
1818

1919
import (
2020
"encoding/json"
21-
"net/http"
22-
"strconv"
23-
2421
openapi "github.com/devtron-labs/devtron/api/openapi/openapiClient"
2522
"github.com/devtron-labs/devtron/api/restHandler/common"
2623
"github.com/devtron-labs/devtron/pkg/apiToken"
@@ -30,6 +27,8 @@ import (
3027
"github.com/juju/errors"
3128
"go.uber.org/zap"
3229
"gopkg.in/go-playground/validator.v9"
30+
"net/http"
31+
"strconv"
3332
)
3433

3534
type ApiTokenRestHandler interface {
@@ -62,7 +61,7 @@ func NewApiTokenRestHandlerImpl(logger *zap.SugaredLogger, apiTokenService apiTo
6261
func (impl ApiTokenRestHandlerImpl) GetAllApiTokens(w http.ResponseWriter, r *http.Request) {
6362
userId, err := impl.userService.GetLoggedInUser(r)
6463
if userId == 0 || err != nil {
65-
common.WriteJsonResp(w, err, "Unauthorized User", http.StatusUnauthorized)
64+
common.HandleUnauthorized(w, r)
6665
return
6766
}
6867

@@ -86,7 +85,7 @@ func (impl ApiTokenRestHandlerImpl) GetAllApiTokens(w http.ResponseWriter, r *ht
8685
func (impl ApiTokenRestHandlerImpl) CreateApiToken(w http.ResponseWriter, r *http.Request) {
8786
userId, err := impl.userService.GetLoggedInUser(r)
8887
if userId == 0 || err != nil {
89-
common.WriteJsonResp(w, err, "Unauthorized User", http.StatusUnauthorized)
88+
common.HandleUnauthorized(w, r)
9089
return
9190
}
9291

@@ -103,19 +102,15 @@ func (impl ApiTokenRestHandlerImpl) CreateApiToken(w http.ResponseWriter, r *htt
103102
err = decoder.Decode(&request)
104103
if err != nil {
105104
impl.logger.Errorw("err in decoding request in CreateApiToken", "err", err)
106-
common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
105+
common.WriteJsonResp(w, errors.New("invalid JSON payload "+err.Error()), nil, http.StatusBadRequest)
107106
return
108107
}
109108

110-
// validate request
109+
// validate request structure
111110
err = impl.validator.Struct(request)
112111
if err != nil {
113-
impl.logger.Errorw("validation err in CreateApiToken", "err", err, "request", request)
114-
common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
115-
return
116-
}
117-
if len(*request.Name) == 0 {
118-
common.WriteJsonResp(w, errors.New("name cannot be blank in the request"), nil, http.StatusBadRequest)
112+
impl.logger.Errorw("validation err in CreateApiToken ", "err", err, "request", request)
113+
common.HandleValidationErrors(w, r, err)
119114
return
120115
}
121116

@@ -132,7 +127,7 @@ func (impl ApiTokenRestHandlerImpl) CreateApiToken(w http.ResponseWriter, r *htt
132127
func (impl ApiTokenRestHandlerImpl) UpdateApiToken(w http.ResponseWriter, r *http.Request) {
133128
userId, err := impl.userService.GetLoggedInUser(r)
134129
if userId == 0 || err != nil {
135-
common.WriteJsonResp(w, err, "Unauthorized User", http.StatusUnauthorized)
130+
common.HandleUnauthorized(w, r)
136131
return
137132
}
138133

@@ -182,7 +177,7 @@ func (impl ApiTokenRestHandlerImpl) UpdateApiToken(w http.ResponseWriter, r *htt
182177
func (impl ApiTokenRestHandlerImpl) DeleteApiToken(w http.ResponseWriter, r *http.Request) {
183178
userId, err := impl.userService.GetLoggedInUser(r)
184179
if userId == 0 || err != nil {
185-
common.WriteJsonResp(w, err, "Unauthorized User", http.StatusUnauthorized)
180+
common.HandleUnauthorized(w, r)
186181
return
187182
}
188183

@@ -221,7 +216,7 @@ func (handler ApiTokenRestHandlerImpl) checkManagerAuth(resource, token, object
221216
func (impl ApiTokenRestHandlerImpl) GetAllApiTokensForWebhook(w http.ResponseWriter, r *http.Request) {
222217
userId, err := impl.userService.GetLoggedInUser(r)
223218
if userId == 0 || err != nil {
224-
common.WriteJsonResp(w, err, "Unauthorized User", http.StatusUnauthorized)
219+
common.HandleUnauthorized(w, r)
225220
return
226221
}
227222

api/appStore/InstalledAppRestHandler.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ func (handler *InstalledAppRestHandlerImpl) FetchAppOverview(w http.ResponseWrit
177177
func (handler InstalledAppRestHandlerImpl) GetAllInstalledApp(w http.ResponseWriter, r *http.Request) {
178178
userId, err := handler.userAuthService.GetLoggedInUser(r)
179179
if userId == 0 || err != nil {
180-
common.WriteJsonResp(w, err, "Unauthorized User", http.StatusUnauthorized)
180+
common.HandleUnauthorized(w, r)
181181
return
182182
}
183183
v := r.URL.Query()
@@ -343,7 +343,7 @@ func (handler InstalledAppRestHandlerImpl) GetAllInstalledApp(w http.ResponseWri
343343
func (handler *InstalledAppRestHandlerImpl) DeployBulk(w http.ResponseWriter, r *http.Request) {
344344
userId, err := handler.userAuthService.GetLoggedInUser(r)
345345
if userId == 0 || err != nil {
346-
common.WriteJsonResp(w, err, "Unauthorized User", http.StatusUnauthorized)
346+
common.HandleUnauthorized(w, r)
347347
return
348348
}
349349
decoder := json.NewDecoder(r.Body)
@@ -512,7 +512,7 @@ func (handler *InstalledAppRestHandlerImpl) getChartGroupInstallMetadata(req *ch
512512
func (handler *InstalledAppRestHandlerImpl) CheckAppExists(w http.ResponseWriter, r *http.Request) {
513513
userId, err := handler.userAuthService.GetLoggedInUser(r)
514514
if userId == 0 || err != nil {
515-
common.WriteJsonResp(w, err, "Unauthorized User", http.StatusUnauthorized)
515+
common.HandleUnauthorized(w, r)
516516
return
517517
}
518518
decoder := json.NewDecoder(r.Body)
@@ -538,7 +538,7 @@ func (impl *InstalledAppRestHandlerImpl) DefaultComponentInstallation(w http.Res
538538
userId, err := impl.userAuthService.GetLoggedInUser(r)
539539
if userId == 0 || err != nil {
540540
impl.Logger.Errorw("service err, DefaultComponentInstallation", "error", err, "userId", userId)
541-
common.WriteJsonResp(w, err, "Unauthorized User", http.StatusUnauthorized)
541+
common.HandleUnauthorized(w, r)
542542
return
543543
}
544544
vars := mux.Vars(r)
@@ -885,7 +885,7 @@ func (handler *InstalledAppRestHandlerImpl) fetchResourceTreeWithHibernateForACD
885885
func (handler *InstalledAppRestHandlerImpl) MigrateDeploymentTypeForChartStore(w http.ResponseWriter, r *http.Request) {
886886
userId, err := handler.userAuthService.GetLoggedInUser(r)
887887
if userId == 0 || err != nil {
888-
common.WriteJsonResp(w, err, "Unauthorized User", http.StatusUnauthorized)
888+
common.HandleUnauthorized(w, r)
889889
return
890890
}
891891

@@ -929,7 +929,7 @@ func (handler *InstalledAppRestHandlerImpl) MigrateDeploymentTypeForChartStore(w
929929
func (handler *InstalledAppRestHandlerImpl) TriggerChartStoreAppAfterMigration(w http.ResponseWriter, r *http.Request) {
930930
userId, err := handler.userAuthService.GetLoggedInUser(r)
931931
if userId == 0 || err != nil {
932-
common.WriteJsonResp(w, err, "Unauthorized User", http.StatusUnauthorized)
932+
common.HandleUnauthorized(w, r)
933933
return
934934
}
935935

api/appStore/chartGroup/ChartGroupRestHandler.go

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import (
2626
"github.com/devtron-labs/devtron/pkg/appStore/chartGroup"
2727
"github.com/devtron-labs/devtron/pkg/auth/authorisation/casbin"
2828
"github.com/devtron-labs/devtron/pkg/auth/user"
29-
"github.com/gorilla/mux"
3029
"go.uber.org/zap"
3130
"gopkg.in/go-playground/validator.v9"
3231
)
@@ -67,7 +66,7 @@ type ChartGroupRestHandler interface {
6766
func (impl *ChartGroupRestHandlerImpl) CreateChartGroup(w http.ResponseWriter, r *http.Request) {
6867
userId, err := impl.userAuthService.GetLoggedInUser(r)
6968
if userId == 0 || err != nil {
70-
common.WriteJsonResp(w, err, "Unauthorized User", http.StatusUnauthorized)
69+
common.HandleUnauthorized(w, r)
7170
return
7271
}
7372
decoder := json.NewDecoder(r.Body)
@@ -112,7 +111,7 @@ func (impl *ChartGroupRestHandlerImpl) CreateChartGroup(w http.ResponseWriter, r
112111
func (impl *ChartGroupRestHandlerImpl) UpdateChartGroup(w http.ResponseWriter, r *http.Request) {
113112
userId, err := impl.userAuthService.GetLoggedInUser(r)
114113
if userId == 0 || err != nil {
115-
common.WriteJsonResp(w, err, "Unauthorized User", http.StatusUnauthorized)
114+
common.HandleUnauthorized(w, r)
116115
return
117116
}
118117
decoder := json.NewDecoder(r.Body)
@@ -153,7 +152,7 @@ func (impl *ChartGroupRestHandlerImpl) UpdateChartGroup(w http.ResponseWriter, r
153152
func (impl *ChartGroupRestHandlerImpl) SaveChartGroupEntries(w http.ResponseWriter, r *http.Request) {
154153
userId, err := impl.userAuthService.GetLoggedInUser(r)
155154
if userId == 0 || err != nil {
156-
common.WriteJsonResp(w, err, "Unauthorized User", http.StatusUnauthorized)
155+
common.HandleUnauthorized(w, r)
157156
return
158157
}
159158
decoder := json.NewDecoder(r.Body)
@@ -187,14 +186,14 @@ func (impl *ChartGroupRestHandlerImpl) SaveChartGroupEntries(w http.ResponseWrit
187186
func (impl *ChartGroupRestHandlerImpl) GetChartGroupWithChartMetaData(w http.ResponseWriter, r *http.Request) {
188187
userId, err := impl.userAuthService.GetLoggedInUser(r)
189188
if userId == 0 || err != nil {
190-
common.WriteJsonResp(w, err, "Unauthorized User", http.StatusUnauthorized)
189+
common.HandleUnauthorized(w, r)
191190
return
192191
}
193-
vars := mux.Vars(r)
194-
chartGroupId, err := strconv.Atoi(vars["chartGroupId"])
192+
193+
// Use enhanced parameter parsing with context
194+
chartGroupId, err := common.ExtractIntPathParamWithContext(w, r, "chartGroupId", "chart group")
195195
if err != nil {
196-
impl.Logger.Errorw("request err, GetChartGroupWithChartMetaData", "err", err, "chartGroupId", chartGroupId)
197-
common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
196+
// Error already written by ExtractIntPathParamWithContext
198197
return
199198
}
200199

@@ -219,14 +218,14 @@ func (impl *ChartGroupRestHandlerImpl) GetChartGroupWithChartMetaData(w http.Res
219218
func (impl *ChartGroupRestHandlerImpl) GetChartGroupInstallationDetail(w http.ResponseWriter, r *http.Request) {
220219
userId, err := impl.userAuthService.GetLoggedInUser(r)
221220
if userId == 0 || err != nil {
222-
common.WriteJsonResp(w, err, "Unauthorized User", http.StatusUnauthorized)
221+
common.HandleUnauthorized(w, r)
223222
return
224223
}
225-
vars := mux.Vars(r)
226-
chartGroupId, err := strconv.Atoi(vars["chartGroupId"])
224+
225+
// Use enhanced parameter parsing with context
226+
chartGroupId, err := common.ExtractIntPathParamWithContext(w, r, "chartGroupId", "chart group")
227227
if err != nil {
228-
impl.Logger.Errorw("request err, GetChartGroupInstallationDetail", "err", err, "chartGroupId", chartGroupId)
229-
common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
228+
// Error already written by ExtractIntPathParamWithContext
230229
return
231230
}
232231

@@ -251,7 +250,7 @@ func (impl *ChartGroupRestHandlerImpl) GetChartGroupInstallationDetail(w http.Re
251250
func (impl *ChartGroupRestHandlerImpl) GetChartGroupList(w http.ResponseWriter, r *http.Request) {
252251
userId, err := impl.userAuthService.GetLoggedInUser(r)
253252
if userId == 0 || err != nil {
254-
common.WriteJsonResp(w, err, "Unauthorized User", http.StatusUnauthorized)
253+
common.HandleUnauthorized(w, r)
255254
return
256255
}
257256

@@ -286,7 +285,7 @@ func (impl *ChartGroupRestHandlerImpl) GetChartGroupList(w http.ResponseWriter,
286285
func (impl *ChartGroupRestHandlerImpl) GetChartGroupListMin(w http.ResponseWriter, r *http.Request) {
287286
userId, err := impl.userAuthService.GetLoggedInUser(r)
288287
if userId == 0 || err != nil {
289-
common.WriteJsonResp(w, err, "Unauthorized User", http.StatusUnauthorized)
288+
common.HandleUnauthorized(w, r)
290289
return
291290
}
292291

@@ -321,7 +320,7 @@ func (impl *ChartGroupRestHandlerImpl) GetChartGroupListMin(w http.ResponseWrite
321320
func (impl *ChartGroupRestHandlerImpl) DeleteChartGroup(w http.ResponseWriter, r *http.Request) {
322321
userId, err := impl.userAuthService.GetLoggedInUser(r)
323322
if userId == 0 || err != nil {
324-
common.WriteJsonResp(w, err, "Unauthorized User", http.StatusUnauthorized)
323+
common.HandleUnauthorized(w, r)
325324
return
326325
}
327326
decoder := json.NewDecoder(r.Body)

api/appStore/deployment/AppStoreDeploymentRestHandler.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func (handler AppStoreDeploymentRestHandlerImpl) InstallApp(w http.ResponseWrite
9393
decoder := json.NewDecoder(r.Body)
9494
userId, err := handler.userAuthService.GetLoggedInUser(r)
9595
if userId == 0 || err != nil {
96-
common.WriteJsonResp(w, err, "Unauthorized User", http.StatusUnauthorized)
96+
common.HandleUnauthorized(w, r)
9797
return
9898
}
9999
var request appStoreBean.InstallAppVersionDTO
@@ -179,7 +179,7 @@ func (handler AppStoreDeploymentRestHandlerImpl) InstallApp(w http.ResponseWrite
179179
func (handler AppStoreDeploymentRestHandlerImpl) GetInstalledAppsByAppStoreId(w http.ResponseWriter, r *http.Request) {
180180
userId, err := handler.userAuthService.GetLoggedInUser(r)
181181
if userId == 0 || err != nil {
182-
common.WriteJsonResp(w, err, "Unauthorized User", http.StatusUnauthorized)
182+
common.HandleUnauthorized(w, r)
183183
return
184184
}
185185

@@ -232,7 +232,7 @@ func (handler AppStoreDeploymentRestHandlerImpl) DeleteInstalledApp(w http.Respo
232232

233233
userId, err := handler.userAuthService.GetLoggedInUser(r)
234234
if userId == 0 || err != nil {
235-
common.WriteJsonResp(w, err, "Unauthorized User", http.StatusUnauthorized)
235+
common.HandleUnauthorized(w, r)
236236
return
237237
}
238238
vars := mux.Vars(r)
@@ -364,7 +364,7 @@ func (handler *AppStoreDeploymentRestHandlerImpl) LinkHelmApplicationToChartStor
364364

365365
userId, err := handler.userAuthService.GetLoggedInUser(r)
366366
if userId == 0 || err != nil {
367-
common.WriteJsonResp(w, err, "Unauthorized User", http.StatusUnauthorized)
367+
common.HandleUnauthorized(w, r)
368368
return
369369
}
370370

@@ -395,7 +395,7 @@ func (handler AppStoreDeploymentRestHandlerImpl) UpdateInstalledApp(w http.Respo
395395
decoder := json.NewDecoder(r.Body)
396396
userId, err := handler.userAuthService.GetLoggedInUser(r)
397397
if userId == 0 || err != nil {
398-
common.WriteJsonResp(w, err, "Unauthorized User", http.StatusUnauthorized)
398+
common.HandleUnauthorized(w, r)
399399
return
400400
}
401401
var request appStoreBean.InstallAppVersionDTO
@@ -474,7 +474,7 @@ func (handler AppStoreDeploymentRestHandlerImpl) UpdateInstalledApp(w http.Respo
474474
func (handler AppStoreDeploymentRestHandlerImpl) GetInstalledAppVersion(w http.ResponseWriter, r *http.Request) {
475475
userId, err := handler.userAuthService.GetLoggedInUser(r)
476476
if userId == 0 || err != nil {
477-
common.WriteJsonResp(w, err, "Unauthorized User", http.StatusUnauthorized)
477+
common.HandleUnauthorized(w, r)
478478
return
479479
}
480480
vars := mux.Vars(r)
@@ -520,7 +520,7 @@ func (handler AppStoreDeploymentRestHandlerImpl) GetInstalledAppVersion(w http.R
520520
func (handler AppStoreDeploymentRestHandlerImpl) UpdateProjectHelmApp(w http.ResponseWriter, r *http.Request) {
521521
userId, err := handler.userAuthService.GetLoggedInUser(r)
522522
if userId == 0 || err != nil {
523-
common.WriteJsonResp(w, err, "Unauthorized User", http.StatusUnauthorized)
523+
common.HandleUnauthorized(w, r)
524524
return
525525
}
526526
token := r.Header.Get("token")

api/appStore/deployment/CommonDeploymentRestHandler.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ func (handler *CommonDeploymentRestHandlerImpl) getAppOfferingMode(installedAppI
134134
func (handler *CommonDeploymentRestHandlerImpl) GetDeploymentHistory(w http.ResponseWriter, r *http.Request) {
135135
userId, err := handler.userAuthService.GetLoggedInUser(r)
136136
if userId == 0 || err != nil {
137-
common.WriteJsonResp(w, err, "Unauthorized User", http.StatusUnauthorized)
137+
common.HandleUnauthorized(w, r)
138138
return
139139
}
140140
v := r.URL.Query()
@@ -181,7 +181,7 @@ func (handler *CommonDeploymentRestHandlerImpl) GetDeploymentHistory(w http.Resp
181181
func (handler *CommonDeploymentRestHandlerImpl) GetDeploymentHistoryValues(w http.ResponseWriter, r *http.Request) {
182182
userId, err := handler.userAuthService.GetLoggedInUser(r)
183183
if userId == 0 || err != nil {
184-
common.WriteJsonResp(w, err, "Unauthorized User", http.StatusUnauthorized)
184+
common.HandleUnauthorized(w, r)
185185
return
186186
}
187187
vars := mux.Vars(r)
@@ -251,7 +251,7 @@ func (handler *CommonDeploymentRestHandlerImpl) GetDeploymentHistoryValues(w htt
251251
func (handler *CommonDeploymentRestHandlerImpl) RollbackApplication(w http.ResponseWriter, r *http.Request) {
252252
userId, err := handler.userAuthService.GetLoggedInUser(r)
253253
if userId == 0 || err != nil {
254-
common.WriteJsonResp(w, err, "Unauthorized User", http.StatusUnauthorized)
254+
common.HandleUnauthorized(w, r)
255255
return
256256
}
257257
request := &openapi2.RollbackReleaseRequest{}

api/appStore/values/AppStoreValuesRestHandler.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func (handler AppStoreValuesRestHandlerImpl) CreateAppStoreVersionValues(w http.
5959
decoder := json.NewDecoder(r.Body)
6060
userId, err := handler.userAuthService.GetLoggedInUser(r)
6161
if userId == 0 || err != nil {
62-
common.WriteJsonResp(w, err, "Unauthorized User", http.StatusUnauthorized)
62+
common.HandleUnauthorized(w, r)
6363
return
6464
}
6565
var request appStoreBean.AppStoreVersionValuesDTO
@@ -84,7 +84,7 @@ func (handler AppStoreValuesRestHandlerImpl) UpdateAppStoreVersionValues(w http.
8484
decoder := json.NewDecoder(r.Body)
8585
userId, err := handler.userAuthService.GetLoggedInUser(r)
8686
if userId == 0 || err != nil {
87-
common.WriteJsonResp(w, err, "Unauthorized User", http.StatusUnauthorized)
87+
common.HandleUnauthorized(w, r)
8888
return
8989
}
9090
var request appStoreBean.AppStoreVersionValuesDTO
@@ -108,7 +108,7 @@ func (handler AppStoreValuesRestHandlerImpl) UpdateAppStoreVersionValues(w http.
108108
func (handler AppStoreValuesRestHandlerImpl) FindValuesById(w http.ResponseWriter, r *http.Request) {
109109
userId, err := handler.userAuthService.GetLoggedInUser(r)
110110
if userId == 0 || err != nil {
111-
common.WriteJsonResp(w, err, "Unauthorized User", http.StatusUnauthorized)
111+
common.HandleUnauthorized(w, r)
112112
return
113113
}
114114
vars := mux.Vars(r)
@@ -161,7 +161,7 @@ func (handler AppStoreValuesRestHandlerImpl) DeleteAppStoreVersionValues(w http.
161161
func (handler AppStoreValuesRestHandlerImpl) FindValuesByAppStoreIdAndReferenceType(w http.ResponseWriter, r *http.Request) {
162162
userId, err := handler.userAuthService.GetLoggedInUser(r)
163163
if userId == 0 || err != nil {
164-
common.WriteJsonResp(w, err, "Unauthorized User", http.StatusUnauthorized)
164+
common.HandleUnauthorized(w, r)
165165
return
166166
}
167167

@@ -185,7 +185,7 @@ func (handler AppStoreValuesRestHandlerImpl) FindValuesByAppStoreIdAndReferenceT
185185
func (handler AppStoreValuesRestHandlerImpl) FetchTemplateValuesByAppStoreId(w http.ResponseWriter, r *http.Request) {
186186
userId, err := handler.userAuthService.GetLoggedInUser(r)
187187
if userId == 0 || err != nil {
188-
common.WriteJsonResp(w, err, "Unauthorized User", http.StatusUnauthorized)
188+
common.HandleUnauthorized(w, r)
189189
return
190190
}
191191
vars := mux.Vars(r)
@@ -221,7 +221,7 @@ func (handler AppStoreValuesRestHandlerImpl) FetchTemplateValuesByAppStoreId(w h
221221
func (handler AppStoreValuesRestHandlerImpl) GetSelectedChartMetadata(w http.ResponseWriter, r *http.Request) {
222222
userId, err := handler.userAuthService.GetLoggedInUser(r)
223223
if userId == 0 || err != nil {
224-
common.WriteJsonResp(w, err, "Unauthorized User", http.StatusUnauthorized)
224+
common.HandleUnauthorized(w, r)
225225
return
226226
}
227227
decoder := json.NewDecoder(r.Body)

0 commit comments

Comments
 (0)