mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
EventExporter( Elastic ) Close the body of response in defer and after verify the error
This commit is contained in:
committed by
Dan Christian Bogos
parent
2d609fb677
commit
e616f64035
@@ -189,9 +189,10 @@ func (eEe *ElasticEe) ExportEvent(cgrEv *utils.CGREventWithOpts) (err error) {
|
||||
|
||||
var resp *esapi.Response
|
||||
if resp, err = eReq.Do(context.Background(), eEe.eClnt); err != nil {
|
||||
resp.Body.Close()
|
||||
return
|
||||
} else if resp.IsError() {
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
if resp.IsError() {
|
||||
var e map[string]interface{}
|
||||
if err = json.NewDecoder(resp.Body).Decode(&e); err != nil {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user