Revert "Assert on request headers only (#57792)"

This reverts commit b5d3565214.
This commit is contained in:
Yannick Welsch 2020-06-09 22:24:35 +02:00
parent 1e8e115ae1
commit 8199956937
2 changed files with 3 additions and 10 deletions

View File

@ -302,13 +302,6 @@ public final class ThreadContext implements Writeable {
return Collections.unmodifiableMap(map);
}
/**
* Returns the request headers, without the default headers
*/
public Map<String, String> getRequestHeadersOnly() {
return Collections.unmodifiableMap(new HashMap<>(threadLocal.get().requestHeaders));
}
/**
* Get a copy of all <em>response</em> headers.
*

View File

@ -62,9 +62,9 @@ public enum Transports {
}
public static boolean assertDefaultThreadContext(ThreadContext threadContext) {
assert threadContext.getRequestHeadersOnly().isEmpty() ||
threadContext.getRequestHeadersOnly().size() == 1 && threadContext.getRequestHeadersOnly().containsKey(Task.X_OPAQUE_ID) :
"expected empty context but was " + threadContext.getRequestHeadersOnly() + " on " + Thread.currentThread().getName();
assert threadContext.getHeaders().isEmpty() ||
threadContext.getHeaders().size() == 1 && threadContext.getHeaders().containsKey(Task.X_OPAQUE_ID) :
"expected empty context but was " + threadContext.getHeaders() + " on " + Thread.currentThread().getName();
return true;
}
}