Commit 553c8800 by Johannes Edmeier

Flush output buffer of the response after writing the headers

This makes sure that the headers are written to the output stream before the async dispatch. Otherwise we end up with strange NPEs when flushing the buffer on writing the body. fixes #715
parent 791fe642
......@@ -92,9 +92,7 @@ public class AbstractInstancesProxyController {
Supplier<BodyInserter<?, ? super ClientHttpRequest>> bodyInserter) {
WebClient.RequestBodySpec bodySpec = instanceWebClient.instance(instance)
.method(method)
.uri(uri)
.headers(instanceHeaders -> instanceHeaders.addAll(
filterHeaders(headers)));
.uri(uri).headers(h -> h.addAll(filterHeaders(headers)));
WebClient.RequestHeadersSpec<?> headersSpec = bodySpec;
if (requiresBody(method)) {
......@@ -143,5 +141,4 @@ public class AbstractInstancesProxyController {
return false;
}
}
}
......@@ -89,6 +89,7 @@ public class InstancesProxyController extends AbstractInstancesProxyController {
response.setStatusCode(clientResponse.statusCode());
response.getHeaders().addAll(filterHeaders(clientResponse.headers().asHttpHeaders()));
OutputStream responseBody = response.getBody();
response.flush();
return clientResponse.body(BodyExtractors.toDataBuffers())
.window(1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment