Hierarchy

  • URL

Constructors

Properties

forceQuery: boolean = false
fragment: string = ''
host: string = ''
opaque: string = ''

encoded opaque data

path: string = ''
rawFragment: string = ''
rawPath: string = ''
rawQuery: string = ''
scheme: string = ''
user?: Userinfo

Accessors

Methods

  • returns the escaped form of this.fragment.

    Remarks

    In general there are multiple possible escaped forms of any fragment. escapedFragment() returns this.rawFragment when it is a valid escaping of this.fragment. Otherwise escapedFragment() ignores this.rawFragment and computes an escaped form on its own.

    The toString method uses escapedFragment() to construct its result. In general, code should call EscapedFragment instead of reading this.rawFragment directly.

    Returns string

  • returns the escaped form of this.path.

    Remarks

    In general there are multiple possible escaped forms of any path. escapedPath() returns this.rawPath when it is a valid escaping of this.path. Otherwise escapedPath() ignores this.rawPath and computes an escaped form on its own.

    The toString and RequestURI method uses escapedPath() to construct its result. In general, code should call escapedPath instead of reading this.rawPath directly.

    Returns string

  • returns this.host, stripping any valid port number if present.

    Remarks

    If the result is enclosed in square brackets, as literal IPv6 addresses are, the square brackets are removed from the result.

    Returns string

  • returns the port part of this.host, without the leading colon.

    Remarks

    If this.host doesn't contain a valid numeric port, Port returns an undefined.

    Returns undefined | string

  • parses rawQuery and returns the corresponding values.

    Returns

    always returns a map containing all the valid query parameters found

    Returns Values

  • returns the encoded path?query or opaque?query string

    Returns string

  • resolves a URI reference to an absolute URI from an absolute base URI this, per RFC 3986 Section 5.2.

    Remarks

    The URI reference may be relative or absolute. resolveReference always returns a new URL instance, even if the returned URL is identical to either the base or reference. If ref is an absolute URL, then resolveReference ignores base and returns a copy of ref.

    Parameters

    Returns URL

  • reassembles the URL into a valid URL string.

    Remarks

    The general form of the result is one of:

    1. scheme:opaque?query#fragment
    2. scheme://userinfo@host/path?query#fragment

    If this.opaque is non-empty, toString uses the first form; otherwise it uses the second form. Any non-ASCII characters in host are escaped. To obtain the path, toString uses this.escapedPath().

    In the second form, the following rules apply:

    • if this.scheme is empty, scheme: is omitted.
    • if this.user is nil, userinfo@ is omitted.
    • if this.host is empty, host/ is omitted.
    • if this.scheme and u.Host are empty and u.User is nil, the entire scheme://userinfo@host/ is omitted.
    • if this.host is non-empty and u.Path begins with a /, the form host/path does not add its own /.
    • if this.rawQuery is empty, ?query is omitted.
    • if this.fragment is empty, #fragment is omitted.

    Parameters

    • redacted: boolean = false

      If true replaces any password with "xxxxx".

    Returns string

  • unmarshal from binary

    Parameters

    • input: BufferSource

    Returns void

  • Parameters

    • rawURL: string
    • viaRequest: boolean

    Returns URL

  • parses a raw url into a URL class.

    Remarks

    The url may be relative (a path, without a host) or absolute (starting with a scheme). Trying to parse a hostname and path without a scheme is invalid but may not necessarily return an error, due to parsing ambiguities.

    Throws

    URLException

    Throws

    Exception

    Parameters

    • rawURL: string

    Returns URL

  • parses a raw url into a URL class.

    Remarks

    It assumes that url was received in an HTTP request, so the url is interpreted only as an absolute URI or an absolute path. The string url is assumed not to have a #fragment suffix. (Web browsers strip #fragment before sending the URL to a web server.)

    Throws

    URLException

    Throws

    Exception

    Parameters

    • rawURL: string

    Returns URL

Generated using TypeDoc