new UrlMatchPattern(options)
UrlMatchPattern allows to create rules to define Urls to match for. It is based on Google's Match Pattern - https://developer.chrome.com/extensions/match_patterns
Parameters:
Name | Type | Description |
---|---|---|
options |
UrlMatchPattern.definition |
- Source:
Example
var matchPattern = new UrlMatchPattern('https://*.google.com/*');
Extends
Members
(static, readonly) MATCH_ALL_URLS :String
String representation for matching all urls - <all_urls>
Type:
- String
- Source:
(static) pattern :String
The url match pattern string
Type:
- String
- Source:
(static, readonly) PROTOCOL_DELIMITER :String
Multiple protocols in the match pattern should be separated by this string
Type:
- String
- Source:
disabled :Boolean
This (optional) flag denotes whether this property is disabled or not. Usually, this is helpful when a property is part of a PropertyList. For example, in a PropertyList of Headers, the ones that are disabled can be filtered out and not processed.
Type:
- Boolean
- Inherited From:
- Source:
id :String
The id
of the property is a unique string that identifies this property and can be used to refer to
this property from relevant other places. It is a good practice to define the id or let the system
auto generate a UUID if one is not defined for properties that require an id
.
Type:
- String
- Inherited From:
- Source:
name :String
A property can have a distinctive and human-readable name. This is to be used to display the name of the
property within Postman, Newman or other runtimes that consume collection. In certain cases, the absence
of name might cause the runtime to use the id
as a fallback.
Type:
- String
- Inherited From:
- Source:
Methods
describe(content, typeopt)
This function allows to describe the property for the purpose of detailed identification or documentation
generation. This function sets or updates the description
child-property of this property.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
content |
String | The content of the description can be provided here as a string. Note that it is expected
that if the content is formatted in any other way than simple text, it should be specified in the subsequent
|
||
type |
String |
<optional> |
"text/plain" | The type of the content. |
- Inherited From:
- Source:
Example
var Collection = require('postman-collection').Collection,
mycollection;
// create a blank collection
myCollection = new Collection();
myCollection.describe('Hey! This is a cool collection.');
console.log(myCollection.description.toString()); // read the description
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(options, iterator)
Invokes the given iterator for every parent in the parent chain of the given element.
Parameters:
Name | Type | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | A set of options for the parent chain traversal. Properties
|
||||||||||
iterator |
function | The function to call for every parent in the ancestry chain. |
- Inherited From:
- Source:
- To Do:
-
- Cache the results
getProtocols() → {Array.<String>}
Returns the protocols supported
- Source:
Returns:
- Type
- Array.<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
test(urlStropt) → {Boolean}
Tests the url string with the match pattern provided. Follows the https://developer.chrome.com/extensions/match_patterns pattern for pattern validation and matching
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
urlStr |
String |
<optional> |
The url string for which the proxy match needs to be done. |
- Source:
Returns:
- Type
- Boolean
testHost(hostopt) → {Boolean}
Tests if the given host string, is allowed by the pattern.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
host |
String |
<optional> |
The host to be checked if the pattern allows. |
- Source:
Returns:
- Type
- Boolean
testPath(pathopt) → {Boolean}
Tests if the current pattern allows the given path.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
String |
<optional> |
The path to be checked if the pattern allows. |
- Source:
Returns:
- Type
- Boolean
testPort(port, protocol) → {Boolean}
Tests if the current pattern allows the given port.
Parameters:
Name | Type | Description |
---|---|---|
port |
String | The port to be checked if the pattern allows. |
protocol |
String | Protocol to refer default port. |
- Source:
Returns:
- Type
- Boolean
testProtocol(protocolopt) → {Boolean}
Tests if the given protocol string, is allowed by the pattern.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
protocol |
String |
<optional> |
The protocol to be checked if the pattern allows. |
- Source:
Returns:
- Type
- Boolean
toJSON() → {Object}
Returns the JSON representation.
- Overrides:
- Source:
Returns:
- Type
- Object
toString() → {String}
Returns a string representation of the match pattern
- Source:
Returns:
pattern
- Type
- String
update(options)
Assigns the given properties to the UrlMatchPattern.
Parameters:
Name | Type | Description |
---|---|---|
options |
Object |
- Source:
Type Definitions
definition
Properties:
Name | Type | Description |
---|---|---|
pattern |
String | The url match pattern string |
- Source: