@@ -289,6 +289,20 @@ func printHTTPRequestResult(result api.HTTPRequestResult) string {
289
289
}
290
290
}
291
291
292
+ filteredTrailers := make (map [string ]string )
293
+ for respK , respV := range result .ResponseTrailers {
294
+ for _ , test := range result .Request .Tests {
295
+ if test .TrailersContain == nil {
296
+ continue
297
+ }
298
+
299
+ interpolatedTestTrailerKey := checks .InterpolateVariables (test .TrailersContain .Key , result .Variables )
300
+ if strings .EqualFold (respK , interpolatedTestTrailerKey ) {
301
+ filteredTrailers [respK ] = respV
302
+ }
303
+ }
304
+ }
305
+
292
306
if len (filteredHeaders ) > 0 {
293
307
str += " Response Headers: \n "
294
308
for k , v := range filteredHeaders {
@@ -317,6 +331,13 @@ func printHTTPRequestResult(result api.HTTPRequestResult) string {
317
331
}
318
332
str += "\n "
319
333
334
+ if len (filteredTrailers ) > 0 {
335
+ str += " Response Trailers: \n "
336
+ for k , v := range filteredTrailers {
337
+ str += fmt .Sprintf (" - %v: %v\n " , k , v )
338
+ }
339
+ }
340
+
320
341
if len (result .Variables ) > 0 {
321
342
str += " Variables available: \n "
322
343
for k , v := range result .Variables {
@@ -554,6 +575,11 @@ func prettyPrintHTTPTest(test api.HTTPRequestTest, variables map[string]string)
554
575
interpolatedValue := checks .InterpolateVariables (test .HeadersContain .Value , variables )
555
576
return fmt .Sprintf ("Expecting headers to contain: '%s: %v'" , interpolatedKey , interpolatedValue )
556
577
}
578
+ if test .TrailersContain != nil {
579
+ interpolatedKey := checks .InterpolateVariables (test .TrailersContain .Key , variables )
580
+ interpolatedValue := checks .InterpolateVariables (test .TrailersContain .Value , variables )
581
+ return fmt .Sprintf ("Expecting trailers to contain: '%s: %v'" , interpolatedKey , interpolatedValue )
582
+ }
557
583
if test .JSONValue != nil {
558
584
var val any
559
585
var op any
0 commit comments