Skip to content

Commit 04ae085

Browse files
committed
test: add test
1 parent ab0cdbb commit 04ae085

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

src/constructs/aws/ServerSideWebsite.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export class ServerSideWebsite extends AwsConstruct {
129129
: undefined;
130130

131131
// Hide the stage in the URL in REST scenario
132-
const originPath = configuration.apiGateway === "rest" ? "/" + provider.serverless.service.provider.stage : undefined
132+
const originPath = configuration.apiGateway === "rest" ? "/" + provider.getStage() : undefined;
133133

134134
this.distribution = new Distribution(this, "CDN", {
135135
comment: `${provider.stackName} ${id} website CDN`,

src/providers/AwsProvider.ts

+9
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,15 @@ export class AwsProvider implements ProviderInterface {
141141
return this.serverless.service.provider.vpc ?? null;
142142
}
143143

144+
/**
145+
* Returns name of the stage.
146+
*
147+
* @internal
148+
*/
149+
getStage(): string {
150+
return this.serverless.service.provider.stage;
151+
}
152+
144153
/**
145154
* Resolves the value of a CloudFormation stack output.
146155
*/

test/unit/serverSideWebsite.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ describe("server-side website", () => {
260260
[{ Ref: "ApiGatewayRestApi" }, "execute-api.us-east-1.amazonaws.com"],
261261
],
262262
},
263+
OriginPath: "/dev",
263264
},
264265
],
265266
},

0 commit comments

Comments
 (0)