Fake Mirrors
    Preparing search index...

    Class HttpUrlWrap

    Wrapper class for HTTP message URLs.

    formatQueryStringOptions: IStringifyBaseOptions = {}

    Custom options for formatting query strings.

    parseQueryStringOptions: IParseBaseOptions = {}

    Custom options for parsing query strings.

    • get isFrozen(): boolean

      Checks if the wrapper is frozen (read-only).

      Returns boolean

      true if the wrapper is frozen, false otherwise.

    • Clones the wrapper with a copy of the URL.

      Returns HttpUrlWrap

      A new independent wrapper instance.

    • Freezes the wrapper to prevent modifications.

      Returns this

      This wrapper for method chaining.

    • Gets a URL component by name.

      Type Parameters

      Parameters

      • name: K

        The name of the URL component.

      Returns HttpUrl[K]

      The value of the URL component.

    • Gets the host part.

      Returns string

      The host string.

    • Gets the URL query string as a parsed object (cached).

      Returns HttpQueryString

      The parsed query string as an object.

      Error If parsing the query string fails.

    • Checks if the URL pathname matches a string or regular expression.

      Parameters

      • arg: string | RegExp | (string | RegExp)[]

        The string path, RegExp pattern to match or array of both.

      Returns boolean

      true if the pathname matches, false otherwise.

    • Merges a partial URL object into the current URL.

      Parameters

      • url: Partial<HttpUrl>

        The partial URL object with properties to update.

      Returns this

      This wrapper for method chaining.

      Error If the wrapper is frozen.

    • Resets the URL to default values.

      Returns this

      This wrapper for method chaining.

      Error If the wrapper is frozen.

    • Sets a URL component by name.

      Type Parameters

      Parameters

      • name: K

        The name of the URL component to set.

      • value: HttpUrl[K]

        The new value for the component.

      Returns this

      This wrapper for method chaining.

      Error If the wrapper is frozen.

    • Sets the URL query string from an object.

      Parameters

      Returns this

      This wrapper for method chaining.

      Error If the wrapper is frozen.

      Error If formatting the query string fails.

    • Returns the URL as an absolute string.

      Returns string

      The absolute URL string.

    • Returns the URL as an object.

      Returns HttpUrl

      A copy of the URL object.

    • Returns the URL as a relative string.

      Returns string

      The relative URL string.

    • Factory method to create a wrapper from an absolute URL string.

      Parameters

      • value: string

        The absolute URL string.

      Returns HttpUrlWrap

      A new wrapper instance.

      Error If the URL cannot be parsed.

    • Factory method to create a wrapper from a relative URL string.

      Parameters

      • value: string

        The relative URL string.

      Returns HttpUrlWrap

      A new wrapper instance.

      Error If the URL cannot be parsed.

    • Factory method to create a wrapper from a request-like object.

      Parameters

      • req: { url?: string }

        The object with an optional url property.

      Returns HttpUrlWrap

      A new wrapper instance.

      Error If req.url is not defined.

    • Factory method to create a wrapper from scratch.

      Returns HttpUrlWrap

      A new wrapper instance with default values.