Type alias ConditionParseResult

ConditionParseResult: {
    applies: boolean;
    parameters() => Record<string, string>;
    subRequest(req) => Request;
}

Result of ContextCondition#parse (used for ContextCondition#appliesTo and ContextCondition#subRequest) Parses the condition, checks if it applies to a request and returns all this information (to avoid double parsing)

Type declaration

  • applies: boolean

    Whether the condition applies to the request

  • parameters:function
  • subRequest:function
    • SubRequest of the condition (if it applies) (used for routing and sub-routing)

      Parameters

      • req: Request

      Returns Request

      Example

      { method: "GET", path: "/api", params: { id: "123" } }
      

Example

{ applies: true, parameters: () => ({ id: "123" }), subRequest: (req) => ({ ...req, path: "/api", params: { id: "123" } }) }

Generated using TypeDoc