Skip to content

Commit

Permalink
Fully drop down to HttpClient to call API endpoint.
Browse files Browse the repository at this point in the history
  • Loading branch information
phw198 committed Dec 9, 2023
1 parent 79be271 commit c810844
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/OutlookGoogleCalendarSync/GoogleOgcs/GoogleCalendar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1737,9 +1737,16 @@ private void getCalendarSettings() {
if (ex.InnerException is Newtonsoft.Json.JsonReaderException && ex.InnerException.Message.Contains("Unexpected character encountered while parsing value: <") && Settings.Instance.Proxy.Type != "None") {
log.Warn("Call to CalendarList API endpoint failed. Retrying with trailing '/' in case of poorly configured proxy.");
//The URI ends with "@group.calendar.google.com", which seemingly can cause confusion - see issue #1745
System.Net.Http.HttpRequestMessage hrm = request.CreateRequest();
hrm.RequestUri = new System.Uri(hrm.RequestUri + "/");
cal = request.Execute();
try {
System.Net.Http.HttpRequestMessage hrm = request.CreateRequest();
hrm.RequestUri = new System.Uri(hrm.RequestUri + "/");
System.Net.Http.HttpResponseMessage response = Service.HttpClient.SendAsync(hrm).Result;
String responseBody = response.Content.ReadAsStringAsync().Result;
cal = Newtonsoft.Json.JsonConvert.DeserializeObject<CalendarListEntry>(responseBody);
} catch (System.Exception ex2) {
OGCSexception.Analyse("Failed retrieving calendarList via HttpRequestMessage.", ex2);
throw;
}
} else throw;
}
log.Info("Google calendar timezone: " + cal.TimeZone);
Expand Down

0 comments on commit c810844

Please sign in to comment.