Example #1
0
        public static Response SetResponseDetails(this IHttpRequestSpanBuilder builder, Response response)
        {
            if (response.HasStream)
            {
                builder.SetAnnotation(Constants.StreamingAnnotation, true);
                builder.SetAnnotation(WellKnownAnnotations.Http.Response.Code, (int)response.Code);

                if (response.Stream is ProxyStream proxyStream)
                {
                    proxyStream.AddAdditionalBuilder(builder);
                    return(response);
                }

                return(response.WithStream(new ProxyStream(response.Stream, builder)));
            }

            builder.SetResponseDetails((int)response.Code, GetContentLength(response));
            builder.Dispose();

            return(response);
        }
Example #2
0
        public void SetResponseDetails_should_record_response_code()
        {
            builder.SetResponseDetails(response);

            builder.Received(1).SetResponseDetails(200, null);
        }