postman-collection
Advanced tools
Comparing version 3.4.6-beta.1 to 3.4.6-beta.2
@@ -5,3 +5,2 @@ var _ = require('../util').lodash, | ||
Url = require('./url').Url, | ||
RequestAuth = require('./request-auth').RequestAuth, | ||
UrlMatchPattern = require('../url-pattern/url-match-pattern').UrlMatchPattern, | ||
@@ -18,3 +17,2 @@ ProxyConfig, | ||
ALLOWED_PROTOCOLS = ['http', 'https'], | ||
BASIC_AUTH_METHOD = 'basic', | ||
// 'http+https://*/*' | ||
@@ -33,3 +31,6 @@ DEFAULT_PATTERN = ALLOWED_PROTOCOLS.join(PROTOCOL_DELIMITER) + PROTOCOL_HOST_SEPARATOR + MATCH_ALL_HOST_AND_PATH; | ||
* @property {Boolean=} [tunnel = false] The tunneling option for the proxy request. | ||
* @property {Boolean=} [disabled = false] To override the proxy for the particiular url, you need to provide true. | ||
* @property {Boolean=} [disabled = false] To override the proxy for the particular url, you need to provide true. | ||
* @property {Boolean=} [authenticate = false] To enable authentication for the proxy, you need to provide true. | ||
* @property {String=} [username] The proxy authentication username | ||
* @property {String=} [password] The proxy authentication password | ||
* | ||
@@ -91,12 +92,24 @@ * @example <caption>JSON definition of an example proxy object</caption> | ||
/** | ||
* Proxy authentication | ||
* @type {RequestAuth} | ||
* This represents whether the tunneling needs to done while proxying this request. | ||
* @type Boolean | ||
*/ | ||
auth: undefined, | ||
tunnel: false, | ||
/** | ||
* This represents whether the tunneling needs to done while proxying this request. | ||
* @type Boolean | ||
* Enable proxy authentication | ||
* @type {Boolean} | ||
*/ | ||
tunnel: false | ||
authenticate: false, | ||
/** | ||
* Proxy auth username | ||
* @type {String} | ||
*/ | ||
username: undefined, | ||
/** | ||
* Proxy auth password | ||
* @type {String} | ||
*/ | ||
password: undefined | ||
}); | ||
@@ -139,8 +152,7 @@ | ||
_.isBoolean(options.tunnel) && (this.tunnel = options.tunnel); | ||
// @todo Add update method in parent class Property and call that here | ||
// todo: Add update method in parent class Property and call that here | ||
_.isBoolean(options.disabled) && (this.disabled = options.disabled); | ||
// only basic auth is supported | ||
// @todo add support for different authentication methods | ||
_.isFunction(options.auth && options.auth.toJSON) && (options.auth = options.auth.toJSON()); | ||
_.isObject(options.auth) && (this.auth = new RequestAuth(options.auth)); | ||
_.isBoolean(options.authenticate) && (this.authenticate = options.authenticate); | ||
_.isString(options.username) && (this.username = options.username); | ||
_.isString(options.password) && (this.password = options.password); | ||
}, | ||
@@ -204,5 +216,14 @@ | ||
if (this.auth && this.auth.type === BASIC_AUTH_METHOD) { | ||
auth = this.auth.current(); | ||
auth = auth.username + COLON + auth.password + AUTH_CREDENTIALS_SEPARATOR; | ||
// Add authentication method to URL if the same is requested. We do it this way because | ||
// this is how `postman-request` library accepts auth credentials in its proxy configuration. | ||
if (this.authenticate) { | ||
auth = (this.username || E); | ||
if (this.password) { | ||
auth += (COLON + (this.password || E)); | ||
} | ||
if (auth) { | ||
auth += AUTH_CREDENTIALS_SEPARATOR; | ||
} | ||
} | ||
@@ -209,0 +230,0 @@ |
@@ -170,3 +170,2 @@ var util = require('../util'), | ||
* @property {Number} responseTime | ||
* @property {Response~timings} [timings] - timing information related to request and response | ||
* | ||
@@ -251,9 +250,2 @@ * @todo pluralise `header`, `cookie` | ||
/** | ||
* Timing information related to request and response | ||
* | ||
* @type {Response~timings} | ||
*/ | ||
timings: options.timings, | ||
/** | ||
* @private | ||
@@ -562,36 +554,2 @@ * @type {Number} | ||
createFromNode: function (response, cookies) { | ||
var timings, | ||
responseTime; | ||
if (response.timingStart) { | ||
/** | ||
* @typedef Response~timings | ||
* @property {Number} start - timestamp of the request sent from the client (in Unix Epoch milliseconds) | ||
* @property {Object} offset - event timestamps in millisecond resolution relative to start | ||
* @property {Number} offset.request - timestamp of the start of the request | ||
* @property {Number} offset.socket - timestamp when the socket is assigned to the request | ||
* @property {Number} offset.lookup - timestamp when the DNS has been resolved | ||
* @property {Number} offset.connect - timestamp when the server acknowledges the TCP connection | ||
* @property {Number} offset.secureConnect - timestamp when secure handshaking process is completed | ||
* @property {Number} offset.response - timestamp when the first bytes are received from the server | ||
* @property {Number} offset.end - timestamp when the last bytes of the response are received | ||
* @property {Number} offset.done - timestamp when the response is received at the client | ||
* | ||
* @note If there were redirects, the properties reflect the timings | ||
* of the final request in the redirect chain | ||
*/ | ||
timings = { | ||
start: response.timingStart, | ||
offset: response.timings | ||
}; | ||
// since requesting client information is missing, we consider that | ||
// there's no client overhead when the request is made | ||
timings.offset.request = 0; | ||
timings.offset.done = timings.offset.end; | ||
// update response time to actual response end time | ||
responseTime = Math.ceil(response.timings.end); | ||
} | ||
return new Response({ | ||
@@ -604,4 +562,3 @@ cookie: cookies, | ||
status: response.statusMessage, | ||
responseTime: responseTime || response.elapsedTime, | ||
timings: timings | ||
responseTime: response.elapsedTime | ||
}); | ||
@@ -652,2 +609,17 @@ }, | ||
* | ||
* @typedef Response~timings | ||
* @property {Number} start - timestamp of the request sent from the client (in Unix Epoch milliseconds) | ||
* @property {Object} offset - event timestamps in millisecond resolution relative to start | ||
* @property {Number} offset.request - timestamp of the start of the request | ||
* @property {Number} offset.socket - timestamp when the socket is assigned to the request | ||
* @property {Number} offset.lookup - timestamp when the DNS has been resolved | ||
* @property {Number} offset.connect - timestamp when the server acknowledges the TCP connection | ||
* @property {Number} offset.secureConnect - timestamp when secure handshaking process is completed | ||
* @property {Number} offset.response - timestamp when the first bytes are received from the server | ||
* @property {Number} offset.end - timestamp when the last bytes of the response are received | ||
* @property {Number} offset.done - timestamp when the response is received at the client | ||
* | ||
* @note If there were redirects, the properties reflect the timings | ||
* of the final request in the redirect chain | ||
* | ||
* @param {Response~timings} timings | ||
@@ -654,0 +626,0 @@ * @returns {Object} |
@@ -5,3 +5,3 @@ { | ||
"author": "Postman Labs <help@getpostman.com>", | ||
"version": "3.4.6-beta.1", | ||
"version": "3.4.6-beta.2", | ||
"keywords": [ | ||
@@ -56,3 +56,3 @@ "postman" | ||
"dependency-check": "3.3.0", | ||
"eslint": "5.15.1", | ||
"eslint": "5.15.2", | ||
"eslint-plugin-jsdoc": "4.4.0", | ||
@@ -59,0 +59,0 @@ "eslint-plugin-lodash": "5.0.1", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
494683
10560