diff --git a/aws-api/src/main/java/com/amplifyframework/api/aws/DomainType.java b/aws-api/src/main/java/com/amplifyframework/api/aws/DomainType.java index ce5d3c27c..8b276d42e 100644 --- a/aws-api/src/main/java/com/amplifyframework/api/aws/DomainType.java +++ b/aws-api/src/main/java/com/amplifyframework/api/aws/DomainType.java @@ -34,7 +34,7 @@ public enum DomainType { CUSTOM; private static final String STANDARD_ENDPOINT_REGEX = - "^https:\\/\\/\\w{26}\\.appsync\\-api\\.\\w{2}(?:(?:\\-\\w{2,})+)\\-\\d\\.amazonaws.com\\/graphql$"; + "^https:\\/\\/\\w{26}\\.appsync\\-api\\.\\w{2}(?:\\-\\w{2,})+\\-\\d\\.amazonaws.com(?:\\.cn)?\\/graphql$"; /** * Get Domain type based on defined endpoint. diff --git a/aws-api/src/test/java/com/amplifyframework/api/aws/DomainTypeTest.java b/aws-api/src/test/java/com/amplifyframework/api/aws/DomainTypeTest.java index da0358c8e..a970b7712 100644 --- a/aws-api/src/test/java/com/amplifyframework/api/aws/DomainTypeTest.java +++ b/aws-api/src/test/java/com/amplifyframework/api/aws/DomainTypeTest.java @@ -24,6 +24,8 @@ public class DomainTypeTest { private static final String STANDARD_URL = "https://abcdefghijklmnopqrstuvwxyz.appsync-api.us-west-2.amazonaws.com/graphql"; + private static final String STANDARD_URL_CHINA = + "https://abcdefghijklmnopqrstuvwxyz.appsync-api.us-west-2.amazonaws.com.cn/graphql"; private static final String CUSTOM_URL = "https://something.in.somedomain.com/graphql"; /** @@ -34,6 +36,14 @@ public void testStandardURLMatch() { Assert.assertEquals(STANDARD, DomainType.from(STANDARD_URL)); } + /** + * Test that Domain type is {@link DomainType#STANDARD} for generated URL. + */ + @Test + public void testStandardURLChinaMatch() { + Assert.assertEquals(STANDARD, DomainType.from(STANDARD_URL_CHINA)); + } + /** * Test that Domain type is set to {@link DomainType#CUSTOM} for custom URLs. */