@@ -102,6 +102,28 @@ testSuite({
102102 assertElementsEquals ( DEFAULT_UNARY_HEADER_VALUES , Object . values ( headers ) ) ;
103103 } ,
104104
105+ async testRpcResponseThenableCall ( ) {
106+ const xhr = new XhrIo ( ) ;
107+ const client = new GrpcWebClientBase ( /* options= */ { } , xhr ) ;
108+ const methodDescriptor = createMethodDescriptor ( ( bytes ) => {
109+ assertElementsEquals ( DEFAULT_RPC_RESPONSE_DATA , [ ] . slice . call ( bytes ) ) ;
110+ return new MockReply ( 'value' ) ;
111+ } ) ;
112+
113+ const responsePromise = client . thenableCall (
114+ 'url' , new MockRequest ( ) , /* metadata= */ { } , methodDescriptor ) ;
115+ xhr . simulatePartialResponse (
116+ googCrypt . encodeByteArray ( new Uint8Array ( DEFAULT_RPC_RESPONSE ) ) ,
117+ DEFAULT_RESPONSE_HEADERS ) ;
118+ xhr . simulateReadyStateChange ( ReadyState . COMPLETE ) ;
119+ const response = await responsePromise ;
120+
121+ assertEquals ( 'value' , response . data ) ;
122+ const headers = /** @type {!Object } */ ( xhr . getLastRequestHeaders ( ) ) ;
123+ assertElementsEquals ( DEFAULT_UNARY_HEADERS , Object . keys ( headers ) ) ;
124+ assertElementsEquals ( DEFAULT_UNARY_HEADER_VALUES , Object . values ( headers ) ) ;
125+ } ,
126+
105127 async testRpcFalsyResponseThenableCall_ForNonProtobufDescriptor ( ) {
106128 const xhr = new XhrIo ( ) ;
107129 const client = new GrpcWebClientBase ( /* options= */ { } , xhr ) ;
0 commit comments