diff --git a/packages/taco/src/conditions/context/context.ts b/packages/taco/src/conditions/context/context.ts index 8e157124..ffb5b0da 100644 --- a/packages/taco/src/conditions/context/context.ts +++ b/packages/taco/src/conditions/context/context.ts @@ -181,22 +181,23 @@ export class ConditionContext { } // If it's a JSON API condition, check url and query if (condition.conditionType === JsonApiConditionType) { - const url = condition.endpoint; - const query = condition.query; - const urlParams = url.match(CONTEXT_PARAM_FULL_MATCH_REGEXP); - if (urlParams) { - for (const param of urlParams) { + const urlComponents = condition.endpoint.replace("https://", "").split("/"); + for (const param of urlComponents ?? []) { + if (this.isContextParameter(param)) { requestedParameters.add(param); } } - if (query) { - const queryParams = query.match(CONTEXT_PARAM_FULL_MATCH_REGEXP); + if (condition.query) { + const queryParams = condition.query.match(":[a-zA-Z_]*"); if (queryParams) { for (const param of queryParams) { requestedParameters.add(param); } } } + if (this.isContextParameter(condition.authorizationToken)) { + requestedParameters.add(condition.authorizationToken); + } } return requestedParameters;