Skip to content

Commit

Permalink
Fix parameter consumption
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Nied <[email protected]>
  • Loading branch information
peternied committed Oct 3, 2023
1 parent 22991e3 commit 828ef2b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -536,12 +536,13 @@ public void onFailure(Exception e) {

@Override
protected final RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) throws IOException {
// consume all parameters first so we can return a correct HTTP status,
// not 400
consumeParameters(request);

return channel -> {
final SecurityRequestChannel securityRequest = SecurityRequestFactory.from(request, channel);

// consume all parameters first so we can return a correct HTTP status,
// not 400
consumeParameters(request);

// check if .opendistro_security index has been initialized
if (!ensureIndexExists()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ public boolean completeWithResponse(int statusCode, Map<String, String> headers,

try {
final BytesRestResponse restResponse = new BytesRestResponse(RestStatus.fromCode(statusCode), body);
headers.forEach(restResponse::addHeader);
if (headers != null) {
headers.forEach(restResponse::addHeader);
}
underlyingChannel.sendResponse(restResponse);

return true;
Expand Down

0 comments on commit 828ef2b

Please sign in to comment.