Skip to content

Commit

Permalink
Propagate proxied request body to opensearch (#17603)
Browse files Browse the repository at this point in the history
  • Loading branch information
todvora authored Dec 6, 2023
1 parent 5c3c03a commit fe6f5b6
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*/
package org.graylog.storage.opensearch2;

import org.graylog.shaded.opensearch2.org.apache.http.entity.ContentType;
import org.graylog.shaded.opensearch2.org.apache.http.entity.InputStreamEntity;
import org.graylog.shaded.opensearch2.org.opensearch.OpenSearchException;
import org.graylog.shaded.opensearch2.org.opensearch.client.Request;
import org.graylog.shaded.opensearch2.org.opensearch.client.ResponseException;
Expand All @@ -35,6 +37,8 @@ public ProxyRequestAdapterOS2(OpenSearchClient openSearchClient) {
@Override
public ProxyResponse request(ProxyRequest request) throws IOException {
final var osRequest = new Request(request.method(), request.path());
osRequest.setEntity(new InputStreamEntity(request.body(), ContentType.APPLICATION_JSON));

try {
final var osResponse = client.execute((c, requestOptions) -> {
osRequest.setOptions(requestOptions);
Expand Down

0 comments on commit fe6f5b6

Please sign in to comment.