Skip to content

Commit 0e81068

Browse files
authored
fix(api): Fix connecting to AppSync from China with API category (#2948)
1 parent 59bde4e commit 0e81068

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

aws-api/src/main/java/com/amplifyframework/api/aws/DomainType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public enum DomainType {
3434
CUSTOM;
3535

3636
private static final String STANDARD_ENDPOINT_REGEX =
37-
"^https:\\/\\/\\w{26}\\.appsync\\-api\\.\\w{2}(?:(?:\\-\\w{2,})+)\\-\\d\\.amazonaws.com\\/graphql$";
37+
"^https:\\/\\/\\w{26}\\.appsync\\-api\\.\\w{2}(?:\\-\\w{2,})+\\-\\d\\.amazonaws.com(?:\\.cn)?\\/graphql$";
3838

3939
/**
4040
* Get Domain type based on defined endpoint.

aws-api/src/test/java/com/amplifyframework/api/aws/DomainTypeTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
public class DomainTypeTest {
2525
private static final String STANDARD_URL =
2626
"https://abcdefghijklmnopqrstuvwxyz.appsync-api.us-west-2.amazonaws.com/graphql";
27+
private static final String STANDARD_URL_CHINA =
28+
"https://abcdefghijklmnopqrstuvwxyz.appsync-api.us-west-2.amazonaws.com.cn/graphql";
2729
private static final String CUSTOM_URL = "https://something.in.somedomain.com/graphql";
2830

2931
/**
@@ -34,6 +36,14 @@ public void testStandardURLMatch() {
3436
Assert.assertEquals(STANDARD, DomainType.from(STANDARD_URL));
3537
}
3638

39+
/**
40+
* Test that Domain type is {@link DomainType#STANDARD} for generated URL.
41+
*/
42+
@Test
43+
public void testStandardURLChinaMatch() {
44+
Assert.assertEquals(STANDARD, DomainType.from(STANDARD_URL_CHINA));
45+
}
46+
3747
/**
3848
* Test that Domain type is set to {@link DomainType#CUSTOM} for custom URLs.
3949
*/

0 commit comments

Comments
 (0)