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));
                }
        }
예제 #2
0
        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"]);
        }
예제 #3
0
        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));
            }
        }
예제 #4
0
        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"]);
        }