public static void SetRequestDetails(this IHttpRequestSpanBuilder builder, Request request) { builder.SetRequestDetails( request.Url, request.Method, request.Content?.Length ?? request.CompositeContent?.Length ?? request.StreamContent?.Length); }
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); }
public void TestSetup() { builder = Substitute.For <IHttpRequestSpanBuilder>(); request = Request.Get("foo/bar"); response = Responses.Ok; }
public void AddAdditionalBuilder(IHttpRequestSpanBuilder value) => additionalBuilder = value;
public ProxyStream(Stream stream, IHttpRequestSpanBuilder builder) { this.stream = stream; this.builder = builder; }