@@ -87,7 +87,11 @@ public static string RenderDetailsPage(DebugEntry x, DebugEnvironment e, string
8787 BuildPayloadSection ( "URL" , string . IsNullOrWhiteSpace ( x . RequestUrl ) ? pathWithQuery : x . RequestUrl , "url" ) ,
8888 BuildHeaderSection ( "Headers" , x . RequestHeaders ) ,
8989 BuildPayloadSection ( "Body" , req , "body" )
90- ] ) ;
90+ ] ,
91+ dataMethod : x . Method ,
92+ dataUrl : string . IsNullOrWhiteSpace ( x . RequestUrl ) ? pathWithQuery : x . RequestUrl ,
93+ dataHeaders : System . Text . Json . JsonSerializer . Serialize ( x . RequestHeaders ) ,
94+ dataBody : x . RequestBody ) ;
9195
9296 var incomingResponse = BuildTraceCard (
9397 "Final Response" ,
@@ -189,7 +193,11 @@ private static string BuildOutgoingRequestCard(DebugOutgoingRequest request)
189193 statusCode : request . StatusCode ,
190194 statusText : request . StatusCode . HasValue ? null : "Failed" ,
191195 durationMs : request . DurationMs ,
192- details : details ) ;
196+ details : details ,
197+ dataMethod : request . Method ,
198+ dataUrl : request . Url ,
199+ dataHeaders : System . Text . Json . JsonSerializer . Serialize ( request . RequestHeaders ) ,
200+ dataBody : request . RequestBody ) ;
193201 }
194202
195203 private static string BuildWaterfallSection ( DebugEntry entry )
@@ -280,7 +288,19 @@ private static string BuildWaterfallSection(DebugEntry entry)
280288 </article>" ;
281289 }
282290
283- private static string BuildTraceCard ( string label , string method , string target , string classes , IEnumerable < string > details , int ? statusCode = null , string ? statusText = null , long ? durationMs = null )
291+ private static string BuildTraceCard (
292+ string label ,
293+ string method ,
294+ string target ,
295+ string classes ,
296+ IEnumerable < string > details ,
297+ int ? statusCode = null ,
298+ string ? statusText = null ,
299+ long ? durationMs = null ,
300+ string ? dataMethod = null ,
301+ string ? dataUrl = null ,
302+ string ? dataHeaders = null ,
303+ string ? dataBody = null )
284304 {
285305 var targetHost = GetDisplayTarget ( target ) ;
286306 var status = statusCode . HasValue
@@ -292,8 +312,30 @@ private static string BuildTraceCard(string label, string method, string target,
292312
293313 var methodPill = ! string . IsNullOrWhiteSpace ( method ) ? $@ "<span class=""method-pill"">{ Encode ( method ) } </span>" : "" ;
294314
315+ var dataAttrs = "" ;
316+ if ( ! string . IsNullOrWhiteSpace ( dataMethod ) ) dataAttrs += $ " data-method=\" { Encode ( dataMethod ) } \" ";
317+ if ( ! string . IsNullOrWhiteSpace ( dataUrl ) ) dataAttrs += $ " data-url=\" { Encode ( dataUrl ) } \" ";
318+ if ( ! string . IsNullOrWhiteSpace ( dataHeaders ) ) dataAttrs += $ " data-headers=\" { Encode ( dataHeaders ) } \" ";
319+ if ( ! string . IsNullOrWhiteSpace ( dataBody ) ) dataAttrs += $ " data-body=\" { Encode ( dataBody ) } \" ";
320+
321+ var copyCurlBtn = "" ;
322+ if ( ! string . IsNullOrWhiteSpace ( dataMethod ) )
323+ {
324+ copyCurlBtn = $@ "
325+ <button class=""curl-copy-btn""
326+ type=""button""
327+ title=""Copy as cURL""
328+ aria-label=""Copy as cURL""
329+ onclick=""copyAsCurl(this)"">
330+ <svg viewBox=""0 0 24 24"" aria-hidden=""true"">
331+ <path d=""M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2""></path>
332+ <rect x=""8"" y=""2"" width=""8"" height=""4"" rx=""1"" ry=""1""></rect>
333+ </svg>
334+ </button>" ;
335+ }
336+
295337 return $@ "
296- <article class=""trace-card { Encode ( classes ) } "">
338+ <article class=""trace-card { Encode ( classes ) } ""{ dataAttrs } >
297339 <div class=""trace-card-main"">
298340 <div class=""trace-card-header"">
299341 <div class=""trace-card-title"">
@@ -305,6 +347,7 @@ private static string BuildTraceCard(string label, string method, string target,
305347 <div class=""trace-card-meta"">
306348 { status }
307349 { duration }
350+ { copyCurlBtn }
308351 </div>
309352 </div>
310353 <div class=""trace-details"">
0 commit comments