Remove URL content from Reindex error response (#630) (#748)

Signed-off-by: Sooraj Sinha <soosinha@amazon.com>

Co-authored-by: Sooraj Sinha <81695996+soosinha@users.noreply.github.com>
This commit is contained in:
Abbas Hussain 2021-05-22 05:50:34 +05:30 committed by GitHub
parent b65c70dee7
commit ea574d13d7
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 {