chore: handle codacy issues

This commit is contained in:
Reinaldy Rafli 2022-09-03 21:35:20 +07:00
parent 3903998363
commit a54de60cc3
No known key found for this signature in database
GPG Key ID: EA1B2522C1693EC8
1 changed files with 2 additions and 2 deletions

View File

@ -44,7 +44,7 @@ func (d *Dependencies) JokeByID(w http.ResponseWriter, r *http.Request) {
id := chi.URLParamFromCtx(r.Context(), "id") id := chi.URLParamFromCtx(r.Context(), "id")
// Parse id to int // Parse id to int
parsedId, err := strconv.Atoi(id) parsedID, err := strconv.Atoi(id)
if err != nil { if err != nil {
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusBadRequest) w.WriteHeader(http.StatusBadRequest)
@ -52,7 +52,7 @@ func (d *Dependencies) JokeByID(w http.ResponseWriter, r *http.Request) {
return return
} }
joke, contentType, err := core.GetJokeByID(r.Context(), d.Bucket, d.Redis, d.Memory, parsedId) joke, contentType, err := core.GetJokeByID(r.Context(), d.Bucket, d.Redis, d.Memory, parsedID)
if err != nil { if err != nil {
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusInternalServerError) w.WriteHeader(http.StatusInternalServerError)