@@ -20,6 +20,7 @@ package client
2020import (
2121 "context"
2222 "errors"
23+ "net/http"
2324 "testing"
2425 "time"
2526)
@@ -146,7 +147,19 @@ func TestConnectionCallPassesOptions(t *testing.T) {
146147 conn := & Connection {refOpts : & ReferenceOptions {invoker : invoker }}
147148
148149 var resp string
149- res , err := conn .call (context .Background (), []any {"req" }, & resp , "Ping" , constant .CallUnary , WithCallRequestTimeout (1500 * time .Millisecond ), WithCallRetries (3 ))
150+ var responseHeader http.Header
151+ var responseTrailer http.Header
152+ res , err := conn .call (
153+ context .Background (),
154+ []any {"req" },
155+ & resp ,
156+ "Ping" ,
157+ constant .CallUnary ,
158+ WithCallRequestTimeout (1500 * time .Millisecond ),
159+ WithCallRetries (3 ),
160+ WithResponseHeader (& responseHeader ),
161+ WithResponseTrailer (& responseTrailer ),
162+ )
150163 require .NoError (t , err )
151164 require .Equal (t , invRes , res )
152165
@@ -158,6 +171,14 @@ func TestConnectionCallPassesOptions(t *testing.T) {
158171
159172 requireCallType (t , inv , constant .CallUnary )
160173 require .Equal (t , []any {"req" , & resp }, inv .ParameterRawValues ())
174+
175+ headerTarget , ok := inv .GetAttribute (constant .ResponseHeaderKey )
176+ require .True (t , ok )
177+ require .Same (t , & responseHeader , headerTarget )
178+
179+ trailerTarget , ok := inv .GetAttribute (constant .ResponseTrailerKey )
180+ require .True (t , ok )
181+ require .Same (t , & responseTrailer , trailerTarget )
161182}
162183
163184func TestCallUnary (t * testing.T ) {
0 commit comments