diff --git a/MangoPay.SDK/Core/RestTool.cs b/MangoPay.SDK/Core/RestTool.cs index ca9da30..5394709 100644 --- a/MangoPay.SDK/Core/RestTool.cs +++ b/MangoPay.SDK/Core/RestTool.cs @@ -72,9 +72,6 @@ internal class RestTool // key-value collection pass to the request private Dictionary _requestData; - // code get from response - private int _responseCode; - // pagination object private Pagination _pagination; @@ -260,18 +257,16 @@ private async Task DoRequestAsync(string urlMethod, T entity = default, var restResponse = await _dto.Client.ExecuteAsync(restRequest); var responseObject = restResponse.Data; - this._responseCode = (int)restResponse.StatusCode; - if (restResponse.StatusCode == HttpStatusCode.OK || restResponse.StatusCode == HttpStatusCode.NoContent) { _log.Debug("Response OK: " + restResponse.Content); } else { - _log.Debug("Response ERROR: " + restResponse.Content); + _log.Debug($"Response ERROR ({(int)restResponse.StatusCode}): " + restResponse.Content); } - if (this._responseCode == 200) + if (restResponse.StatusCode == HttpStatusCode.OK) { _log.Debug("Response object: " + responseObject.ToString()); } @@ -348,18 +343,16 @@ private async Task> DoRequestListAsync(string urlMethod, Dic responseObject = new ListPaginated(restResponse.Data); - this._responseCode = (int)restResponse.StatusCode; - if (restResponse.StatusCode == HttpStatusCode.OK || restResponse.StatusCode == HttpStatusCode.NoContent) { _log.Debug("Response OK: " + restResponse.Content); } else { - _log.Debug("Response ERROR: " + restResponse.Content); + _log.Debug($"Response ERROR ({(int)restResponse.StatusCode}): " + restResponse.Content); } - if (this._responseCode == 200) + if (restResponse.StatusCode == HttpStatusCode.OK) { responseObject = this.ReadResponseHeaders(restResponse, responseObject);