amadeus4dev / amadeus-node

Node library for the Amadeus Self-Service travel APIs
https://developers.amadeus.com
MIT License
191 stars 66 forks source link

It does log error message in console even the API call finishes with success status code. #205

Open harishsharma29 opened 10 months ago

harishsharma29 commented 10 months ago

Hi! πŸ‘‹

Firstly, thanks for your work on this project! πŸ™‚

Today I used patch-package to patch amadeus@9.1.0 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/amadeus/lib/amadeus/client/listener.js b/node_modules/amadeus/lib/amadeus/client/listener.js
index ea05aa6..e49953f 100644
--- a/node_modules/amadeus/lib/amadeus/client/listener.js
+++ b/node_modules/amadeus/lib/amadeus/client/listener.js
@@ -48,7 +48,6 @@ var Listener = /*#__PURE__*/function () {
       var response = new _response["default"](http_response, this.request);
       http_response.on('data', response.addChunk.bind(response));
       http_response.on('end', this.onEnd(response).bind(this));
-      http_response.on('close', this.onNetworkError(response).bind(this));
       http_response.on('error', this.onNetworkError(response).bind(this));
     }

This issue body was partially generated by patch-package.

minjikarin commented 9 months ago

Hello @harishsharma29 , Thank you for your PR!

However we want to keep the potential network errors logs in case any. Can you share what was the reason that you don't want to see the log and any other suggestion?