Remove URL content from Reindex error response (#630)

Signed-off-by: Sooraj Sinha <soosinha@amazon.com>
This commit is contained in:
Sooraj Sinha 2021-05-07 20:03:16 +05:30 committed by GitHub
parent 61f4c7d5a4
commit a8b8a96036
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -186,8 +186,9 @@ public class RemoteScrollableHitSource extends ScrollableHitSource {
}
if (xContentType == null) {
try {
logger.debug("Response didn't include Content-Type: " + bodyMessage(response.getEntity()));
throw new OpenSearchException(
"Response didn't include Content-Type: " + bodyMessage(response.getEntity()));
"Response didn't include supported Content-Type, remote is likely not an OpenSearch instance");
} catch (IOException e) {
OpenSearchException ee = new OpenSearchException("Error extracting body from response");
ee.addSuppressed(e);

View File

@ -94,7 +94,6 @@ import java.util.stream.Stream;
import static org.opensearch.common.unit.TimeValue.timeValueMillis;
import static org.opensearch.common.unit.TimeValue.timeValueMinutes;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.instanceOf;
@ -472,7 +471,7 @@ public class RemoteScrollableHitSourceTests extends OpenSearchTestCase {
public void testNoContentTypeIsError() {
RuntimeException e = expectListenerFailure(RuntimeException.class, (RejectAwareActionListener<Version> listener) ->
sourceWithMockedRemoteCall(false, null, "main/0_20_5.json").lookupRemoteVersion(listener));
assertThat(e.getMessage(), containsString("Response didn't include Content-Type: body={"));
assertEquals(e.getMessage(), "Response didn't include supported Content-Type, remote is likely not an OpenSearch instance");
}
public void testInvalidJsonThinksRemoteIsNotES() throws IOException {