Merge pull request #503 from padloc/fix/stripe-path-handling

Fix path parsing in case stripe server is hosted on a subpath
This commit is contained in:
Martin Kleinschrodt 2022-07-25 09:00:29 +02:00 committed by GitHub
commit 55763f8027
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -1464,7 +1464,7 @@ export class StripeProvisioner extends BasicProvisioner {
protected async _handleRequest(httpReq: IncomingMessage, httpRes: ServerResponse) {
const path = new URL(httpReq.url!, "http://localhost").pathname;
if (path === "/stripe_webhooks") {
if (path.endsWith("/stripe_webhooks")) {
if (httpReq.method !== "POST") {
httpRes.statusCode = 405;
httpRes.end();
@ -1474,7 +1474,7 @@ export class StripeProvisioner extends BasicProvisioner {
return this._handleStripeEvent(httpReq, httpRes);
}
if (path === "/sync") {
if (path.endsWith("/sync")) {
if (httpReq.method !== "POST") {
httpRes.statusCode = 405;
httpRes.end();
@ -1484,7 +1484,7 @@ export class StripeProvisioner extends BasicProvisioner {
return this._handleSyncBilling(httpReq, httpRes);
}
if (path === "/portal") {
if (path.endsWith("/portal")) {
if (httpReq.method !== "GET") {
httpRes.statusCode = 405;
httpRes.end();
@ -1494,7 +1494,7 @@ export class StripeProvisioner extends BasicProvisioner {
return this._handlePortalRequest(httpReq, httpRes);
}
if (path == "/callback") {
if (path.endsWith("/callback")) {
if (httpReq.method !== "GET") {
httpRes.statusCode = 405;
httpRes.end();