Insomnia-Script-SDK-Docs
    Preparing search index...

    Class RequestBody

    Represents the base class for properties. This class provides common functionality for managing hierarchical relationships, metadata, and JSON serialization of properties.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _kind: string = 'PropertyBase'
    _parent: undefined | PropertyBase = undefined

    A reference to the parent property, if any. This allows for hierarchical relationships between properties. If no parent exists, the value will be undefined.

    description?: string

    An optional description providing additional details or context.

    file?: string
    graphql?: { operationName: string; query: string; variables: object }
    options?: object
    raw?: string
    urlencoded?: PropertyList<QueryParam>

    Methods

    • Traverses up the parent hierarchy to find an ancestor that contains the specified property. Optionally, a customizer function can be provided to determine if the ancestor should be returned.

      Parameters

      • property: string

        The name of the property to search for in the ancestors.

      • Optionalcustomizer: (ancester: PropertyBase) => boolean

        An optional function that takes an ancestor as input and returns a boolean. If provided, the traversal continues until the customizer returns a truthy value. If not provided, the traversal stops at the first ancestor that contains the property.

      Returns undefined | PropertyBase

      The first ancestor that satisfies the search criteria, or undefined if no such ancestor is found.

    • Iterates through the parent hierarchy of the current object, starting from its immediate parent. The iteration continues until the provided iterator function returns false or there are no more parents.

      Parameters

      • options: { withRoot?: boolean }

        Options to control the iteration behavior.

        • withRoot (optional): A flag to include the root object in the iteration.
      • iterator: (obj: PropertyBase) => boolean

        A callback function that is invoked for each parent object in the hierarchy.

        • The function receives a cloned instance of the parent object as its argument.
        • If the function returns false, the iteration stops.

      Returns undefined | PropertyBase | PropertyBase[]

      An array of cloned parent objects that were iterated over.

    • Determines if a given property key is considered a "meta" property. In the context of Insomnia, meta properties are defined as those that start with an underscore (_). The underscore character itself is also rejected as a valid meta property key.

      Parameters

      • _value: any

        The value associated with the property (currently unused in this method).

      • key: string

        The property key to evaluate.

      Returns boolean | ""

      true if the key starts with an underscore (_), otherwise false.