Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support content type application/x-ndjson in DeprecationRestHandler #36025

Merged
merged 2 commits into from
Nov 29, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ public void handleRequest(RestRequest request, RestChannel channel, NodeClient c
handler.handleRequest(request, channel, client);
}

@Override
public boolean supportsContentStream() {
return handler.supportsContentStream();
}

/**
* This does a very basic pass at validating that a header's value contains only expected characters according to RFC-5987, and those
* that it references.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

/**
* Tests {@link DeprecationRestHandler}.
Expand Down Expand Up @@ -114,6 +115,13 @@ public void testInvalidHeaderValueEmpty() {
expectThrows(IllegalArgumentException.class, () -> DeprecationRestHandler.requireValidHeader(blank));
}

public void testSupportsContentStream() {
DeprecationRestHandler deprecationRestHandler = new DeprecationRestHandler(handler, deprecationMessage, deprecationLogger);
when(handler.supportsContentStream()).thenReturn(true).thenReturn(false);
assertTrue(deprecationRestHandler.supportsContentStream());
assertFalse(deprecationRestHandler.supportsContentStream());
}

/**
* {@code ASCIIHeaderGenerator} only uses characters expected to be valid in headers (simplified US-ASCII).
*/
Expand Down