File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
apollo/apollo-appsync/src
main/java/com/amplifyframework/apollo/appsync
test/java/com/amplifyframework/apollo/appsync Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ import java.net.URL
2121import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
2222
2323private val standardEndpointRegex =
24- " ^https://\\ w{26}\\ .appsync-api\\ .\\ w{2}(?:-\\ w{2,})+-\\ d\\ .amazonaws.com/graphql$" .toRegex()
24+ " ^https://\\ w{26}\\ .appsync-api\\ .\\ w{2}(?:-\\ w{2,})+-\\ d\\ .amazonaws.com(?: \\ .cn)? /graphql$" .toRegex()
2525
2626/* *
2727 * Class representing the AppSync endpoint. There are multiple URLs associated with each AppSync endpoint: the
Original file line number Diff line number Diff line change @@ -26,6 +26,8 @@ import org.junit.Test
2626
2727class AppSyncEndpointTest {
2828 private val standardAppSyncUrl = " https://example1234567890123456789.appsync-api.us-east-1.amazonaws.com/graphql"
29+ private val standardAppSyncUrlChina =
30+ " https://example1234567890123456789.appsync-api.us-east-1.amazonaws.com.cn/graphql"
2931 private val customAppSyncUrl = " https://api.example.com/graphql"
3032
3133 @Test
@@ -48,6 +50,13 @@ class AppSyncEndpointTest {
4850 " https://example1234567890123456789.appsync-realtime-api.us-east-1.amazonaws.com/graphql/connect"
4951 }
5052
53+ @Test
54+ fun `uses expected realtime URL for standard endpoint in China` () {
55+ val endpoint = AppSyncEndpoint (standardAppSyncUrlChina)
56+ endpoint.websocketConnection.toString() shouldBe
57+ " https://example1234567890123456789.appsync-realtime-api.us-east-1.amazonaws.com.cn/graphql/connect"
58+ }
59+
5160 @Test
5261 fun `uses expected realtime URL for custom endpoint` () {
5362 val endpoint = AppSyncEndpoint (customAppSyncUrl)
You can’t perform that action at this time.
0 commit comments