(t *testing.T, statusCode codes.Code, msg string)
| 362 | } |
| 363 | |
| 364 | func handleStreamCloseBodyTest(t *testing.T, statusCode codes.Code, msg string) { |
| 365 | st := newHandleStreamTest(t, nil) |
| 366 | |
| 367 | handleStream := func(s *ServerStream) { |
| 368 | s.WriteStatus(status.New(statusCode, msg)) |
| 369 | } |
| 370 | ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout) |
| 371 | defer cancel() |
| 372 | st.ht.HandleStreams( |
| 373 | ctx, func(s *ServerStream) { go handleStream(s) }, |
| 374 | ) |
| 375 | wantHeader := http.Header{ |
| 376 | "Date": nil, |
| 377 | "Content-Type": {"application/grpc"}, |
| 378 | "Trailer": {"Grpc-Status", "Grpc-Message", "Grpc-Status-Details-Bin"}, |
| 379 | } |
| 380 | wantTrailer := http.Header{ |
| 381 | "Grpc-Status": {fmt.Sprint(uint32(statusCode))}, |
| 382 | "Grpc-Message": {encodeGrpcMessage(msg)}, |
| 383 | } |
| 384 | checkHeaderAndTrailer(t, st.rw, wantHeader, wantTrailer) |
| 385 | } |
| 386 | |
| 387 | func (s) TestHandlerTransport_HandleStreams_Timeout(t *testing.T) { |
| 388 | bodyr, bodyw := io.Pipe() |
no test coverage detected