mirror of https://github.com/grpc/grpc-java.git
Fix test checking for invalid content type
Previously, if the content type was being ignored the error code would have been UNKNOWN since there was no grpc-status. That seems very to accidentally pass, so now if the content type is ignored it would get OK.
This commit is contained in:
parent
47ad6f81bf
commit
1e1d53b78f
|
|
@ -267,11 +267,13 @@ public class NettyClientStreamTest extends NettyStreamTestBase<NettyClientStream
|
||||||
Http2Headers headers = new DefaultHttp2Headers().status(STATUS_OK).set(CONTENT_TYPE_HEADER,
|
Http2Headers headers = new DefaultHttp2Headers().status(STATUS_OK).set(CONTENT_TYPE_HEADER,
|
||||||
new ByteString("application/bad", UTF_8));
|
new ByteString("application/bad", UTF_8));
|
||||||
stream().transportHeadersReceived(headers, false);
|
stream().transportHeadersReceived(headers, false);
|
||||||
stream().transportHeadersReceived(new DefaultHttp2Headers(), true);
|
Http2Headers trailers = new DefaultHttp2Headers()
|
||||||
|
.set(new ByteString("grpc-status", UTF_8), new ByteString("0", UTF_8));
|
||||||
|
stream().transportHeadersReceived(trailers, true);
|
||||||
ArgumentCaptor<Status> captor = ArgumentCaptor.forClass(Status.class);
|
ArgumentCaptor<Status> captor = ArgumentCaptor.forClass(Status.class);
|
||||||
verify(listener).closed(captor.capture(), any(Metadata.class));
|
verify(listener).closed(captor.capture(), any(Metadata.class));
|
||||||
Status status = captor.getValue();
|
Status status = captor.getValue();
|
||||||
assertEquals(status.getCode(), Status.Code.INTERNAL);
|
assertEquals(Status.Code.INTERNAL, status.getCode());
|
||||||
assertTrue(status.getDescription().contains("content-type"));
|
assertTrue(status.getDescription().contains("content-type"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue