public HttpRequestMessage PrepareRequest(HttpMethod method, string reqUri) { if (!reqUri.StartsWith("http") && !string.IsNullOrWhiteSpace(ApiRootUrl)) { reqUri = ApiRootUrl.TrimEnd('/') + "/" + reqUri.TrimStart('/'); } ; HttpRequestMessage requestMessage = new HttpRequestMessage(method, reqUri); return(requestMessage); }
protected T InvokeApi <T>(ApiRequestData data) where T : new() { try { string apiUrl = ApiRootUrl.TrimEnd('/') + "/" + data.apiPath; Stopwatch watch = Stopwatch.StartNew(); T resp = InvokeApi <T>(apiUrl, data, this.Logger); LogElapsedTime(watch, apiUrl, data.postData); return(resp); } catch (Exception ex) { Logger.Error($"{data.apiPath} {ex.ToString()}"); T resp = new T(); return(resp); } }