Url

Url

new Url(options)

Defines a URL.

Parameters:
Name Type Description
options Object | String
Source:

Extends

Members

auth :String

Type:
  • String
Source:

hash :String

Type:
  • String
Source:

host :Array.<String>

Type:
  • Array.<String>
Source:

path :Array.<String>

Type:
  • Array.<String>
Source:

port :String

Type:
  • String
Source:

protocol :String

Type:
  • String
Source:

query :PropertyList.<QueryParam>

Type:
Source:

variables :VariableList

Type:
Source:

Methods

(static) isUrl(obj) → {Boolean}

Checks whether an object is a Url

Parameters:
Name Type Description
obj *
Source:
Returns:
Type
Boolean

(static) parse(url) → {Object}

Parses a string to a PostmanUrl, decomposing the URL into it's constitutent parts, such as path, host, port, etc.

Parameters:
Name Type Description
url String
Source:
Returns:
Type
Object

addQueryParams(params)

Add query parameters to the URL.

Parameters:
Name Type Description
params Object | String

Key value pairs to add to the URL.

Source:

findInParents(property, customizeropt) → {*|undefined}

Tries to find the given property locally, and then proceeds to lookup in each parent, going up the chain as necessary. Lookup will continue until customizer returns a truthy value. If used without a customizer, the lookup will stop at the first parent that contains the property.

Parameters:
Name Type Attributes Description
property String
customizer function <optional>
Inherited From:
Source:
Returns:
Type
* | undefined

forEachParent(optionsopt, iterator)

Invokes the given iterator for every parent in the parent chain of the given element.

Parameters:
Name Type Attributes Default Description
options Object | Boolean <optional>
{}

A set of options for the parent chain traversal.

Properties
Name Type Attributes Default Description
withRoot Boolean <optional>
<nullable>
false

Set to true to include the collection object as well.

iterator function

The function to call for every parent in the ancestry chain.

Inherited From:
Source:
To Do:
  • Cache the results

getHost() → {string}

Returns the host only

Source:
Returns:
Type
string

getOAuth1BaseUrl()

Returns a OAuth1.0-a compatible representation of the request URL, also called "Base URL". For details, http://oauth.net/core/1.0a/#anchor13

todo: should we ignore the auth parameters of the URL or not? (the standard does not mention them) we currently are.

Source:

getPath(optionsopt) → {string}

Returns the request path, with a leading '/'.

Parameters:
Name Type Attributes Description
options Object <optional>
Properties
Name Type Description
unresolved Object

If set to true, path variables will not be processed

Source:
Returns:
Type
string

getPathWithQuery() → {*|string}

Returns the complete path, including the query string.

Source:
Returns:
Type
* | string
Example
/something/postman?hi=notbye

getQueryString(optionsopt, nullable) → {String}

Returns the stringified query string for this URL.

Parameters:
Name Type Attributes Default Description
options Object <optional>
<nullable>
{}
Properties
Name Type Attributes Description
encode Boolean <nullable>

Enables URL encoding when processing the query string.

ignoreDisabled Boolean <nullable>

Prevents disabled query parameters from showing up in the unparsed result.

Source:
Returns:
Type
String

getRaw() → {string}

Unparses a {PostmanUrl} into a string.

Deprecated:
Source:
Returns:
Type
string

getRemote(options) → {String}

Returns the host and port (if any), separated by a ":"

Parameters:
Name Type Description
options Object
Properties
Name Type Description
forcePort Boolean
Source:
Returns:
Type
String

meta() → {*}

Returns the meta keys associated with the property

Inherited From:
Source:
Returns:
Type
*

parent() → {*|undefined}

Returns the parent of item

Inherited From:
Source:
Returns:
Type
* | undefined

removeQueryParams(params)

Removes query parameters from the URL.

Parameters:
Name Type Description
params Array.<QueryParam> | Array.<String> | String

Params should be an array of strings, or an array of actual query parameters, or a string containing the parameter key.

Source:

toJSON()

Returns the JSON representation of a property, which conforms to the way it is defined in a collection. You can use this method to get the instantaneous representation of any property, including a Collection.

Inherited From:
Source:

toString(forceProtocolopt) → {string}

Unparses a {PostmanUrl} into a string.

Parameters:
Name Type Attributes Description
forceProtocol Boolean <optional>

Forces the URL to have a protocol

Source:
Returns:
Type
string

update(url)

Set a URL.

Parameters:
Name Type Description
url String | Object
Source: