fix: resolved comments
This commit is contained in:
@@ -33,15 +33,11 @@ func SendAck(w http.ResponseWriter) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
data, err := json.Marshal(resp)
|
data, _ := json.Marshal(resp) //should not fail here
|
||||||
if err != nil {
|
|
||||||
http.Error(w, "failed to marshal response", http.StatusInternalServerError)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
_, err = w.Write(data)
|
_, err := w.Write(data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, "failed to write response", http.StatusInternalServerError)
|
http.Error(w, "failed to write response", http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
@@ -57,12 +53,7 @@ func nack(w http.ResponseWriter, err *model.Error, status int, ctx context.Conte
|
|||||||
Error: err,
|
Error: err,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
data, jsonErr := json.Marshal(resp)
|
data, _ := json.Marshal(resp) //should not fail here
|
||||||
if jsonErr != nil {
|
|
||||||
fmt.Printf("Error marshaling response: %v, MessageID: %s", jsonErr, ctx.Value(model.MsgIDKey))
|
|
||||||
http.Error(w, fmt.Sprintf("Internal server error, MessageID: %s", ctx.Value(model.MsgIDKey)), http.StatusInternalServerError)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
w.WriteHeader(status)
|
w.WriteHeader(status)
|
||||||
|
|||||||
Reference in New Issue
Block a user