Skip to content

Commit

Permalink
DO NOT MERGE: attempt to fail on alreayd set headers
Browse files Browse the repository at this point in the history
  • Loading branch information
FroMage committed Feb 8, 2024
1 parent 44b8b12 commit 36811c0
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,24 @@ public Entry(MessageBodyWriter<?> writer, MediaType mediaType) {

public static void encodeResponseHeaders(ResteasyReactiveRequestContext requestContext) {
ServerHttpResponse vertxResponse = requestContext.serverResponse();
boolean ouch = false;
for (java.util.Map.Entry<String, String> entry : vertxResponse.getAllResponseHeaders()) {
// allow content headers, since those are set before (not sure by whom, though)
if (entry.getKey().equalsIgnoreCase(CONTENT_TYPE)
|| entry.getKey().equalsIgnoreCase("Content-Length")
|| entry.getKey().equalsIgnoreCase("Transfer-Encoding")
// JAX-RS Request.selectVariant has this side-effect
|| entry.getKey().equalsIgnoreCase("Vary")
|| (entry.getKey().equalsIgnoreCase("Operation")
&& entry.getValue().equalsIgnoreCase("PROCEEDTHROWSWEBAPPEXCEPTION"))) {
continue;
}
System.err.println("Found header: " + entry.getKey() + ": " + entry.getValue());
ouch = true;
}
if (ouch) {
throw new RuntimeException("Assertion failed: found vert.x headers before setting response");
}
LazyResponse lazyResponse = requestContext.getResponse();
if (!lazyResponse.isCreated() && lazyResponse.isPredetermined()) {
//fast path
Expand Down

0 comments on commit 36811c0

Please sign in to comment.