public override async Task <SentryResponse> SendEventAsync( SentryEventData eventData) { if (!IsEnabled) { return(SentryResponse.Empty()); } using (var stream = _serializer.Serialize(eventData)) using (var res = await SendMessageAsync(stream)) { var responseProvider = new SentryResponseProvider(_serializer); return(await responseProvider.GetResponseAsync(res)); } }
public async Task ParsesExampleEventId() { var response = new HttpResponseMessage { Content = JsonContent(ExampleJson) }; var sentryResponse = await ResponseProvider.GetResponseAsync(response); Assert.Equal(ExampleEventId, sentryResponse.EventId); Assert.Equal(ExampleEventId, sentryResponse["id"]); }
public override async Task <SentryResponse> SendEventAsync( SentryEventData eventData) { if (!IsEnabled) { return(SentryResponse.Empty); } using (var stream = _streamSerializer.Serialize(eventData)) { var httpResponse = await _sender .SendAsync(ComposeMessage(stream), None) .ConfigureAwait(false); var responseProvider = new SentryResponseProvider(_streamSerializer); return(await responseProvider.GetResponseAsync(httpResponse)); } }
public async Task ReturnsEventIdFromJsonBody(string json, string eventId) { var response = new HttpResponseMessage { Content = new StringContent(json, Sentry.ApiEncoding, "application/json") }; var sentryResponse = await ResponseProvider.GetResponseAsync(response); Assert.Equal(eventId, sentryResponse.EventId); Assert.Equal(eventId, sentryResponse["id"]); }