Skip to content

Commit

Permalink
By pass host.docker.internal for HTTPS checks (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
lijamie98 authored Jul 24, 2023
1 parent d3b051c commit 3fac095
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 8 deletions.
5 changes: 4 additions & 1 deletion @stellar/anchor-tests/src/tests/sep1/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,10 @@ const validUrls: Test = {
if (!u) return;
if (
!u.startsWith("https://") &&
!config.homeDomain.includes("localhost")
!(
config.homeDomain.includes("localhost") ||
config.homeDomain.includes("host.docker.internal")
)
) {
result.failure = makeFailure(this.failureModes.NO_HTTPS);
} else if (u.slice(-1) === "/") {
Expand Down
5 changes: 4 additions & 1 deletion @stellar/anchor-tests/src/tests/sep10/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ export const hasWebAuthEndpoint: Test = {
}
if (
!this.context.expects.tomlObj.WEB_AUTH_ENDPOINT.startsWith("https") &&
!config.homeDomain.includes("localhost")
!(
config.homeDomain.includes("localhost") ||
config.homeDomain.includes("host.docker.internal")
)
) {
result.failure = makeFailure(this.failureModes.NO_HTTPS);
return result;
Expand Down
5 changes: 4 additions & 1 deletion @stellar/anchor-tests/src/tests/sep12/toml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ export const hasKycServerUrl: Test = {
}
if (
!this.context.provides.kycServerUrl.startsWith("https") &&
!config.homeDomain.includes("localhost")
!(
config.homeDomain.includes("localhost") ||
config.homeDomain.includes("host.docker.internal")
)
) {
result.failure = makeFailure(this.failureModes.NO_HTTPS);
return result;
Expand Down
5 changes: 4 additions & 1 deletion @stellar/anchor-tests/src/tests/sep24/toml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ export const hasTransferServerUrl: Test = {
}
if (
!this.context.provides.transferServerUrl.startsWith("https") &&
!config.homeDomain.includes("localhost")
!(
config.homeDomain.includes("localhost") ||
config.homeDomain.includes("host.docker.internal")
)
) {
result.failure = makeFailure(this.failureModes.NO_HTTPS);
return result;
Expand Down
5 changes: 4 additions & 1 deletion @stellar/anchor-tests/src/tests/sep31/toml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ export const hasDirectPaymentServer: Test = {
}
if (
!this.context.provides.directPaymentServerUrl.startsWith("https") &&
!config.homeDomain.includes("localhost")
!(
config.homeDomain.includes("localhost") ||
config.homeDomain.includes("host.docker.internal")
)
) {
result.failure = makeFailure(this.failureModes.NO_HTTPS);
return result;
Expand Down
9 changes: 7 additions & 2 deletions @stellar/anchor-tests/src/tests/sep38/toml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,17 @@ export const hasQuoteServer: Test = {
this.context.provides.quoteServerUrl =
this.context.expects.tomlObj.ANCHOR_QUOTE_SERVER;
if (!this.context.provides.quoteServerUrl) {
result.failure = makeFailure(this.failureModes.ANCHOR_QUOTE_SERVER_NOT_FOUND);
result.failure = makeFailure(
this.failureModes.ANCHOR_QUOTE_SERVER_NOT_FOUND,
);
return result;
}
if (
!this.context.provides.quoteServerUrl.startsWith("https") &&
!config.homeDomain.includes("localhost")
!(
config.homeDomain.includes("localhost") ||
config.homeDomain.includes("host.docker.internal")
)
) {
result.failure = makeFailure(this.failureModes.NO_HTTPS);
return result;
Expand Down
5 changes: 4 additions & 1 deletion @stellar/anchor-tests/src/tests/sep6/toml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ export const hasTransferServerUrl: Test = {
}
if (
!this.context.provides.sep6TransferServerUrl.startsWith("https") &&
!config.homeDomain.includes("localhost")
!(
config.homeDomain.includes("localhost") ||
config.homeDomain.includes("host.docker.internal")
)
) {
result.failure = makeFailure(this.failureModes.NO_HTTPS);
return result;
Expand Down

0 comments on commit 3fac095

Please sign in to comment.