@@ -289,6 +289,20 @@ func printHTTPRequestResult(result api.HTTPRequestResult) string {
289289 }
290290 }
291291
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+
292306 if len (filteredHeaders ) > 0 {
293307 str += " Response Headers: \n "
294308 for k , v := range filteredHeaders {
@@ -317,6 +331,13 @@ func printHTTPRequestResult(result api.HTTPRequestResult) string {
317331 }
318332 str += "\n "
319333
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+
320341 if len (result .Variables ) > 0 {
321342 str += " Variables available: \n "
322343 for k , v := range result .Variables {
@@ -554,6 +575,11 @@ func prettyPrintHTTPTest(test api.HTTPRequestTest, variables map[string]string)
554575 interpolatedValue := checks .InterpolateVariables (test .HeadersContain .Value , variables )
555576 return fmt .Sprintf ("Expecting headers to contain: '%s: %v'" , interpolatedKey , interpolatedValue )
556577 }
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+ }
557583 if test .JSONValue != nil {
558584 var val any
559585 var op any
0 commit comments