Add an HTTP header to response from Nomulus after successful login (#879)

* Add a logged-in response header

* small fixes

* Refactor EPP test cases to check for headers

* small change
This commit is contained in:
sarahcaseybot 2020-12-01 19:24:56 -05:00 committed by GitHub
parent f92819243d
commit b0fad6c87b
7 changed files with 96 additions and 12 deletions

View file

@ -249,6 +249,20 @@ class EppServiceHandlerTest {
assertThat(channel.isActive()).isFalse();
}
@Test
void sendResponseToNextHandler_unrecognizedHeader() throws Exception {
setHandshakeSuccess();
String content = "<epp>stuff</epp>";
HttpResponse response = makeEppHttpResponse(content, HttpResponseStatus.OK);
response.headers().set("unrecognized-header", "test");
channel.writeOutbound(response);
ByteBuf expectedResponse = channel.readOutbound();
assertThat(Unpooled.wrappedBuffer(content.getBytes(UTF_8))).isEqualTo(expectedResponse);
// Nothing further to pass to the next handler.
assertThat((Object) channel.readOutbound()).isNull();
assertThat(channel.isActive()).isTrue();
}
@Test
void testFailure_disconnectOnNonOKResponseStatus() throws Exception {
setHandshakeSuccess();