postman-runtime 7.26.3-beta.1 → 7.26.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/dependabot.yml +11 -0
- package/.travis.yml +4 -0
- package/CHANGELOG.yaml +18 -0
- package/dist/index.js +30 -32
- package/lib/authorizer/oauth1.js +13 -3
- package/lib/authorizer/oauth2.js +5 -2
- package/lib/runner/extensions/event.command.js +1 -1
- package/npm/dist.js +39 -0
- package/package.json +16 -13
- package/test/integration/auth-methods/digest.test.js +1 -1
- package/test/integration/auth-methods/ntlm.test.js +1 -1
- package/test/integration/auth-methods/oauth1.test.js +6 -3
- package/test/integration/benchmark/large-response.test.js +1 -1
- package/test/integration/bootstrap.js +0 -1
- package/test/integration/file-uploads/request-body.test.js +17 -8
- package/test/integration/protocol-profile-behavior/disableBodyPruning.test.js +11 -5
- package/test/integration/protocol-profile-behavior/disabledSystemHeaders.test.js +1 -1
- package/test/integration/protocol-profile-behavior/sanity.test.js +1 -1
- package/test/integration/request-body/form-data.test.js +9 -4
- package/test/integration/request-flow/headers.test.js +1 -1
- package/test/integration/request-flow/intermediate-requests.test.js +2 -1
- package/test/integration/request-flow/invalid-url.test.js +1 -1
- package/test/integration/request-flow/ipv6-localhost.test.js +1 -1
- package/test/integration/request-flow/pm-send-request-cookies.test.js +1 -1
- package/test/integration/request-flow/requests-from-sandbox.test.js +3 -2
- package/test/integration/request-flow/response-cookies.test.js +1 -1
- package/test/integration/request-flow/unicode-url.test.js +1 -1
- package/test/integration/request-flow/url-encoding.test.js +1 -1
- package/test/integration/requester-spec/agents.test.js +1 -1
- package/test/integration/requester-spec/extendedRootCA.test.js +1 -1
- package/test/integration/requester-spec/history.test.js +1 -1
- package/test/integration/requester-spec/maxResponseSize.test.js +1 -1
- package/test/integration/requester-spec/redirect.test.js +1 -1
- package/test/integration/requester-spec/timing.test.js +1 -1
- package/test/integration/requester-spec/useWhatWGUrlParser.test.js +1 -1
- package/test/integration/runner-spec/ignoreProxySystemVariables.test.js +1 -1
- package/test/integration/sandbox-libraries/pm.test.js +8 -4
- package/test/integration/sanity/certificate.test.js +1 -1
- package/test/integration/sanity/content-type-in-form-data.test.js +1 -1
- package/test/integration/sanity/cookie-handling.test.js +1 -1
- package/test/integration/sanity/dns-lookup.test.js +1 -1
- package/test/integration/sanity/econnrefused.test.js +1 -1
- package/test/integration/sanity/file-uploads.test.js +1 -1
- package/test/integration/sanity/form-data-order.test.js +1 -1
- package/test/integration/sanity/http-methods.test.js +6 -3
- package/test/integration/sanity/http-reason-phrases.test.js +1 -1
- package/test/integration/sanity/multi-value-response-headers.test.js +1 -1
- package/test/integration/sanity/proxy-http-vars.test.js +1 -1
- package/test/integration/sanity/proxy-http.test.js +1 -1
- package/test/integration/sanity/redirect.test.js +6 -3
- package/test/integration/sanity/request-size.test.js +1 -1
- package/test/integration/sanity/response-status-message.test.js +1 -1
- package/test/integration/sanity/restricted-addresses.test.js +1 -1
- package/test/integration/sanity/script-result.test.js +1 -1
- package/test/integration/sanity/server-ssl.test.js +1 -1
- package/test/integration/sanity/systemproxy.test.js +1 -1
- package/test/integration/sanity/timeouts/request.test.js +1 -1
- package/test/integration/sanity/timeouts/sync-scripts.test.js +1 -1
- package/test/integration/sanity/uvm-globals-this.test.js +1 -1
- package/test/integration/sanity/v2-regression.test.js +1 -1
- package/test/karma.conf.js +2 -2
- package/test/system/repository.test.js +11 -2
- package/test/unit/auth-handlers.test.js +114 -0
- package/test/unit/version.test.js +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var sinon = require('sinon'),
|
|
2
2
|
expect = require('chai').expect;
|
|
3
3
|
|
|
4
|
-
describe('Requester Spec: redirect', function () {
|
|
4
|
+
(typeof window === 'undefined' ? describe : describe.skip)('Requester Spec: redirect', function () {
|
|
5
5
|
var testrun;
|
|
6
6
|
|
|
7
7
|
describe('with followOriginalHttpMethod: false', function () {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var expect = require('chai').expect;
|
|
2
2
|
|
|
3
|
-
describe('Requester Spec: useWhatWGUrlParser', function () {
|
|
3
|
+
(typeof window === 'undefined' ? describe : describe.skip)('Requester Spec: useWhatWGUrlParser', function () {
|
|
4
4
|
var testrun,
|
|
5
5
|
URL = 'https://postman-echo.com/get?q=(%{^*^}%)',
|
|
6
6
|
collection = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var ProxyConfigList = require('postman-collection').ProxyConfigList,
|
|
2
2
|
expect = require('chai').expect;
|
|
3
3
|
|
|
4
|
-
describe('Runner Spec: ignoreProxyEnvironmentVariables', function () {
|
|
4
|
+
(typeof window === 'undefined' ? describe : describe.skip)('Runner Spec: ignoreProxyEnvironmentVariables', function () {
|
|
5
5
|
var testrun;
|
|
6
6
|
|
|
7
7
|
before(function () {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
var expect = require('chai').expect,
|
|
2
2
|
sinon = require('sinon'),
|
|
3
|
-
postmanRequest = require('postman-request')
|
|
3
|
+
postmanRequest = require('postman-request'),
|
|
4
|
+
IS_BROWSER = typeof window !== 'undefined';
|
|
4
5
|
|
|
5
6
|
describe('sandbox library - pm api', function () {
|
|
6
7
|
var testrun;
|
|
@@ -60,7 +61,7 @@ describe('sandbox library - pm api', function () {
|
|
|
60
61
|
});
|
|
61
62
|
});
|
|
62
63
|
|
|
63
|
-
describe('chai', function () {
|
|
64
|
+
(IS_BROWSER ? describe.skip : describe)('chai', function () {
|
|
64
65
|
before(function (done) {
|
|
65
66
|
this.run({
|
|
66
67
|
collection: {
|
|
@@ -140,7 +141,8 @@ describe('sandbox library - pm api', function () {
|
|
|
140
141
|
});
|
|
141
142
|
});
|
|
142
143
|
|
|
143
|
-
describe('sendRequest', function () {
|
|
144
|
+
(IS_BROWSER ? describe.skip : describe)('sendRequest', function () {
|
|
145
|
+
// eslint-disable-next-line mocha/no-sibling-hooks
|
|
144
146
|
before(function (done) {
|
|
145
147
|
this.run({
|
|
146
148
|
collection: {
|
|
@@ -173,6 +175,7 @@ describe('sandbox library - pm api', function () {
|
|
|
173
175
|
});
|
|
174
176
|
});
|
|
175
177
|
|
|
178
|
+
// eslint-disable-next-line mocha/no-identical-title
|
|
176
179
|
it('should complete the run', function () {
|
|
177
180
|
expect(testrun).to.be.ok;
|
|
178
181
|
sinon.assert.calledOnce(testrun.start);
|
|
@@ -186,6 +189,7 @@ describe('sandbox library - pm api', function () {
|
|
|
186
189
|
sinon.assert.calledWith(testrun.response.getCall(0), null);
|
|
187
190
|
});
|
|
188
191
|
|
|
192
|
+
// eslint-disable-next-line mocha/no-identical-title
|
|
189
193
|
it('should run the test script successfully', function () {
|
|
190
194
|
sinon.assert.calledOnce(testrun.script);
|
|
191
195
|
sinon.assert.calledWith(testrun.script.getCall(0), null);
|
|
@@ -206,7 +210,7 @@ describe('sandbox library - pm api', function () {
|
|
|
206
210
|
});
|
|
207
211
|
|
|
208
212
|
|
|
209
|
-
describe('cookies.jar', function () {
|
|
213
|
+
(IS_BROWSER ? describe.skip : describe)('cookies.jar', function () {
|
|
210
214
|
describe('get', function () {
|
|
211
215
|
before(function (done) {
|
|
212
216
|
this.run({
|
|
@@ -3,7 +3,7 @@ var fs = require('fs'),
|
|
|
3
3
|
expect = require('chai').expect,
|
|
4
4
|
CertificateList = require('postman-collection').CertificateList;
|
|
5
5
|
|
|
6
|
-
describe('certificates', function () {
|
|
6
|
+
(typeof window === 'undefined' ? describe : describe.skip)('certificates', function () {
|
|
7
7
|
var certDataPath = path.join(__dirname, '..', '..', 'fixtures', 'certificates'),
|
|
8
8
|
certificateId = 'test-certificate',
|
|
9
9
|
testrun;
|
|
@@ -2,7 +2,7 @@ var fs = require('fs'),
|
|
|
2
2
|
sinon = require('sinon'),
|
|
3
3
|
expect = require('chai').expect;
|
|
4
4
|
|
|
5
|
-
describe('form-data with numeric keys', function () {
|
|
5
|
+
(typeof window === 'undefined' ? describe : describe.skip)('form-data with numeric keys', function () {
|
|
6
6
|
var testrun;
|
|
7
7
|
|
|
8
8
|
before(function (done) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
var fs = require('fs'),
|
|
2
2
|
sinon = require('sinon'),
|
|
3
|
-
expect = require('chai').expect
|
|
3
|
+
expect = require('chai').expect,
|
|
4
|
+
IS_BROWSER = typeof window !== 'undefined';
|
|
4
5
|
|
|
5
6
|
describe('http methods', function () {
|
|
6
7
|
var testrun,
|
|
@@ -143,7 +144,7 @@ describe('http methods', function () {
|
|
|
143
144
|
});
|
|
144
145
|
});
|
|
145
146
|
|
|
146
|
-
describe('urlencoded', function () {
|
|
147
|
+
(IS_BROWSER ? describe.skip : describe)('urlencoded', function () {
|
|
147
148
|
before(function (done) {
|
|
148
149
|
this.run({
|
|
149
150
|
collection: {
|
|
@@ -243,7 +244,8 @@ describe('http methods', function () {
|
|
|
243
244
|
});
|
|
244
245
|
});
|
|
245
246
|
|
|
246
|
-
describe('file', function () {
|
|
247
|
+
(IS_BROWSER ? describe.skip : describe)('file', function () {
|
|
248
|
+
// eslint-disable-next-line mocha/no-sibling-hooks
|
|
247
249
|
before(function (done) {
|
|
248
250
|
this.run({
|
|
249
251
|
fileResolver: fs,
|
|
@@ -267,6 +269,7 @@ describe('http methods', function () {
|
|
|
267
269
|
});
|
|
268
270
|
});
|
|
269
271
|
|
|
272
|
+
// eslint-disable-next-line mocha/no-identical-title
|
|
270
273
|
it('should complete the run', function () {
|
|
271
274
|
expect(testrun).to.be.ok;
|
|
272
275
|
sinon.assert.calledOnce(testrun.start);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var ProxyConfigList = require('postman-collection').ProxyConfigList,
|
|
2
2
|
expect = require('chai').expect;
|
|
3
3
|
|
|
4
|
-
describe('proxy', function () {
|
|
4
|
+
(typeof window === 'undefined' ? describe : describe.skip)('proxy', function () {
|
|
5
5
|
var testrun;
|
|
6
6
|
|
|
7
7
|
describe('sanity', function () {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
var fs = require('fs'),
|
|
2
2
|
sinon = require('sinon'),
|
|
3
|
-
expect = require('chai').expect
|
|
3
|
+
expect = require('chai').expect,
|
|
4
|
+
IS_BROWSER = typeof window !== 'undefined';
|
|
4
5
|
|
|
5
6
|
describe('redirects', function () {
|
|
6
7
|
var testrun;
|
|
@@ -87,7 +88,7 @@ describe('redirects', function () {
|
|
|
87
88
|
});
|
|
88
89
|
});
|
|
89
90
|
|
|
90
|
-
describe('307 redirect', function () {
|
|
91
|
+
(IS_BROWSER ? describe.skip : describe)('307 redirect', function () {
|
|
91
92
|
before(function (done) {
|
|
92
93
|
this.run({
|
|
93
94
|
fileResolver: fs,
|
|
@@ -142,7 +143,8 @@ describe('redirects', function () {
|
|
|
142
143
|
});
|
|
143
144
|
});
|
|
144
145
|
|
|
145
|
-
describe('308 redirect', function () {
|
|
146
|
+
(IS_BROWSER ? describe.skip : describe)('308 redirect', function () {
|
|
147
|
+
// eslint-disable-next-line mocha/no-sibling-hooks
|
|
146
148
|
before(function (done) {
|
|
147
149
|
this.run({
|
|
148
150
|
fileResolver: fs,
|
|
@@ -172,6 +174,7 @@ describe('redirects', function () {
|
|
|
172
174
|
});
|
|
173
175
|
});
|
|
174
176
|
|
|
177
|
+
// eslint-disable-next-line mocha/no-identical-title
|
|
175
178
|
it('should complete the run', function () {
|
|
176
179
|
expect(testrun).to.be.ok;
|
|
177
180
|
sinon.assert.calledOnce(testrun.start);
|
|
@@ -2,7 +2,7 @@ var net = require('net'),
|
|
|
2
2
|
expect = require('chai').expect,
|
|
3
3
|
enableServerDestroy = require('server-destroy');
|
|
4
4
|
|
|
5
|
-
describe('request size', function () {
|
|
5
|
+
(typeof window === 'undefined' ? describe : describe.skip)('request size', function () {
|
|
6
6
|
var server,
|
|
7
7
|
testrun,
|
|
8
8
|
POSTMAN = 'postman',
|
|
@@ -88,7 +88,7 @@ describe('script result format', function () {
|
|
|
88
88
|
expect(test).to.have.deep.property('data', {});
|
|
89
89
|
});
|
|
90
90
|
|
|
91
|
-
it('should have cookies in the result', function () {
|
|
91
|
+
(typeof window === 'undefined' ? it : it.skip)('should have cookies in the result', function () {
|
|
92
92
|
var prerequest = testrun.script.firstCall.args[2],
|
|
93
93
|
test = testrun.script.secondCall.args[2];
|
|
94
94
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var expect = require('chai').expect,
|
|
2
2
|
sdk = require('postman-collection');
|
|
3
3
|
|
|
4
|
-
describe('systemProxy', function () {
|
|
4
|
+
(typeof window === 'undefined' ? describe : describe.skip)('systemProxy', function () {
|
|
5
5
|
var testrun;
|
|
6
6
|
|
|
7
7
|
describe('valid output config', function () {
|
|
@@ -167,7 +167,7 @@ describe('synchronous script timeouts', function () {
|
|
|
167
167
|
});
|
|
168
168
|
});
|
|
169
169
|
|
|
170
|
-
describe('script timeout', function () {
|
|
170
|
+
(typeof window === 'undefined' ? describe : describe.skip)('script timeout', function () {
|
|
171
171
|
var testrun;
|
|
172
172
|
|
|
173
173
|
before(function (done) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var expect = require('chai').expect;
|
|
2
2
|
|
|
3
|
-
describe('UVM allowed globals', function () {
|
|
3
|
+
(typeof window === 'undefined' ? describe : describe.skip)('UVM allowed globals', function () {
|
|
4
4
|
var testrun,
|
|
5
5
|
globals = ['isNaN', 'SyntaxError', 'ArrayBuffer', 'JSON', 'unescape', 'URIError', 'TypeError', 'WeakSet',
|
|
6
6
|
'Array', 'parseFloat', 'EvalError', 'parseInt', 'Error', 'Object', 'Int16Array',
|
package/test/karma.conf.js
CHANGED
|
@@ -22,8 +22,8 @@ module.exports = function (config) {
|
|
|
22
22
|
// preprocess matching files before serving them to the browser
|
|
23
23
|
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
|
|
24
24
|
preprocessors: {
|
|
25
|
-
'../index.js': ['browserify'],
|
|
26
|
-
'../test/unit/**/*.js': ['browserify'],
|
|
25
|
+
'../index.js': ['browserify'],
|
|
26
|
+
'../test/unit/**/*.js': ['browserify'],
|
|
27
27
|
'../test/integration/**/*.js': ['browserify']
|
|
28
28
|
},
|
|
29
29
|
// test results reporter to use
|
|
@@ -133,6 +133,10 @@ describe('project repository', function () {
|
|
|
133
133
|
it('should have valid content', function () {
|
|
134
134
|
expect(gitignore).to.not.be.empty;
|
|
135
135
|
});
|
|
136
|
+
|
|
137
|
+
it('should ignore the dist directory', function () {
|
|
138
|
+
expect(gitignore).to.include('dist/**');
|
|
139
|
+
});
|
|
136
140
|
});
|
|
137
141
|
|
|
138
142
|
describe(npmignorePath, function () {
|
|
@@ -143,10 +147,15 @@ describe('project repository', function () {
|
|
|
143
147
|
it('should have valid content', function () {
|
|
144
148
|
expect(npmignore).to.not.be.empty;
|
|
145
149
|
});
|
|
150
|
+
|
|
151
|
+
it('should not ignore the dist directory', function () {
|
|
152
|
+
expect(npmignore).not.to.include('dist/**');
|
|
153
|
+
});
|
|
146
154
|
});
|
|
147
155
|
|
|
148
|
-
|
|
149
|
-
|
|
156
|
+
// eslint-disable-next-line mocha/valid-test-description
|
|
157
|
+
it('.gitignore coverage must be a subset of .npmignore coverage (except dist directory)', function () {
|
|
158
|
+
expect(_.intersection(gitignore, _.union(npmignore, ['dist/**']))).to.eql(gitignore);
|
|
150
159
|
});
|
|
151
160
|
});
|
|
152
161
|
|
|
@@ -1305,6 +1305,70 @@ describe('Auth Handler:', function () {
|
|
|
1305
1305
|
});
|
|
1306
1306
|
});
|
|
1307
1307
|
|
|
1308
|
+
// issue: https://github.com/postmanlabs/postman-app-support/issues/8737
|
|
1309
|
+
it('should generate correct signature for empty callback and addEmptyParamsToSign:true', function () {
|
|
1310
|
+
var rawReq = {
|
|
1311
|
+
url: 'https://postman-echo.com/oauth1',
|
|
1312
|
+
auth: {
|
|
1313
|
+
type: 'oauth1',
|
|
1314
|
+
oauth1: {
|
|
1315
|
+
consumerKey: 'RKCGzna7bv9YD57c',
|
|
1316
|
+
consumerSecret: 'D+EdQ-gs$-%@2Nu7',
|
|
1317
|
+
token: 'foo',
|
|
1318
|
+
tokenSecret: 'bar',
|
|
1319
|
+
signatureMethod: 'HMAC-SHA1',
|
|
1320
|
+
timestamp: '1461319769',
|
|
1321
|
+
nonce: 'ik3oT5',
|
|
1322
|
+
version: '1.0',
|
|
1323
|
+
verifier: 'bar',
|
|
1324
|
+
callback: '',
|
|
1325
|
+
addParamsToHeader: false,
|
|
1326
|
+
addEmptyParamsToSign: true
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
},
|
|
1330
|
+
request = new Request(rawReq),
|
|
1331
|
+
auth = request.auth,
|
|
1332
|
+
authInterface = createAuthInterface(auth),
|
|
1333
|
+
handler = AuthLoader.getHandler(auth.type);
|
|
1334
|
+
|
|
1335
|
+
handler.sign(authInterface, request, function () {
|
|
1336
|
+
expect(request.url.query.get('oauth_signature')).to.eql('w8WS1SXfe/dtJu/4tH5DaD7qZgM=');
|
|
1337
|
+
});
|
|
1338
|
+
});
|
|
1339
|
+
|
|
1340
|
+
// issue: https://github.com/postmanlabs/postman-app-support/issues/8737
|
|
1341
|
+
it('should generate correct signature for empty verifier and addEmptyParamsToSign:true', function () {
|
|
1342
|
+
var rawReq = {
|
|
1343
|
+
url: 'https://postman-echo.com/oauth1',
|
|
1344
|
+
auth: {
|
|
1345
|
+
type: 'oauth1',
|
|
1346
|
+
oauth1: {
|
|
1347
|
+
consumerKey: 'RKCGzna7bv9YD57c',
|
|
1348
|
+
consumerSecret: 'D+EdQ-gs$-%@2Nu7',
|
|
1349
|
+
token: 'foo',
|
|
1350
|
+
tokenSecret: 'bar',
|
|
1351
|
+
signatureMethod: 'HMAC-SHA1',
|
|
1352
|
+
timestamp: '1461319769',
|
|
1353
|
+
nonce: 'ik3oT5',
|
|
1354
|
+
version: '1.0',
|
|
1355
|
+
verifier: '',
|
|
1356
|
+
callback: 'http://postman.com',
|
|
1357
|
+
addParamsToHeader: false,
|
|
1358
|
+
addEmptyParamsToSign: true
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
},
|
|
1362
|
+
request = new Request(rawReq),
|
|
1363
|
+
auth = request.auth,
|
|
1364
|
+
authInterface = createAuthInterface(auth),
|
|
1365
|
+
handler = AuthLoader.getHandler(auth.type);
|
|
1366
|
+
|
|
1367
|
+
handler.sign(authInterface, request, function () {
|
|
1368
|
+
expect(request.url.query.get('oauth_signature')).to.eql('WO1RMBRLIM5Anfxxt8P7Kbt82b4=');
|
|
1369
|
+
});
|
|
1370
|
+
});
|
|
1371
|
+
|
|
1308
1372
|
it('should generate correct signature for RSA based signature method', function () {
|
|
1309
1373
|
// eslint-disable-next-line max-len
|
|
1310
1374
|
var privateKey = '-----BEGIN RSA PRIVATE KEY-----\nMIICWwIBAAKBgFKLvzM9zbm3I0+HWcHlBSqpfRY/bKs6NDLclERrzfnReFV4utjkhjaEQPPT6tHVHKrZkcxmIgwe3XrkJkUjcuingXIF+Fc3KpY61qJ4HSM50qIuHdi+C5YfuXwNrh6OOeZAhhqgSw2e2XqPfATbkYYwpIFpdVdcH/Pb2ynpd6VXAgMBAAECgYAbQE+LFyhH25Iou0KCpJ0kDHhjU+UIUlrRP8kjHYQOqXzUmtr0p903OkpHNPsc8wJX1SQxGra60aXE4HVR9fYFQNliAnSmA/ztGR4ddnirK1Gzog4y2OOkicTdSqJ/1XXtTEDSRkA0Z2DIqcWgudeSDzVjUpreYwQ/rCEZbi50AQJBAJcf9wi5bU8tdZUCg3/8MNDwHhr4If4V/9kmhsgNp+M/9tHwCbD05hCbiGS7g58DPF+6V2K30qQYq7yvBP8Te4ECQQCL1GhX/YwkD6rexi0E1bjz+RqhNLTR9kexkTfSYmL6zHeeIFSH8ROioGOJMU51lUtMNkkrKEeki5SZpkfaQOzXAkAvBnJPU6vQ7HtfH8YdiDMEgQNNLxMcxmmzf4qHK8CnNRsvnnrVho8kcdFSTwsY6t/Zhdl1TXANQeQGtYtfeAeBAkEAhUB351JSWJMtrHqCsFbTmHxNKk7F+kiObeMLpUvpM0PiwifhJmNQ6Oubr0Pzlw4c4ZXiCGSsUVxK0lmpo423pQJATYDoxVhZrKA3xDAifWoyxbyxf/WXtUGDaAOuZc/naVN5TKiqaEO6G+k3NpmOXNKsYU/Zd9e6P/TnfU74TyDDDA==\n-----END RSA PRIVATE KEY-----',
|
|
@@ -1568,6 +1632,56 @@ describe('Auth Handler:', function () {
|
|
|
1568
1632
|
});
|
|
1569
1633
|
});
|
|
1570
1634
|
|
|
1635
|
+
it('should separate custom header prefix and token with a space', function () {
|
|
1636
|
+
var clonedRequestObj,
|
|
1637
|
+
request,
|
|
1638
|
+
auth,
|
|
1639
|
+
authInterface,
|
|
1640
|
+
handler;
|
|
1641
|
+
|
|
1642
|
+
clonedRequestObj = _.cloneDeep(requestObj);
|
|
1643
|
+
clonedRequestObj.auth.oauth2.headerPrefix = 'Postman';
|
|
1644
|
+
|
|
1645
|
+
request = new Request(clonedRequestObj);
|
|
1646
|
+
auth = request.auth;
|
|
1647
|
+
authInterface = createAuthInterface(auth);
|
|
1648
|
+
handler = AuthLoader.getHandler(auth.type);
|
|
1649
|
+
|
|
1650
|
+
handler.sign(authInterface, request, _.noop);
|
|
1651
|
+
|
|
1652
|
+
expect(request.headers.all()).to.be.an('array').that.has.lengthOf(1);
|
|
1653
|
+
expect(request.headers.toJSON()[0]).to.eql({
|
|
1654
|
+
key: 'Authorization',
|
|
1655
|
+
value: 'Postman ' + requestObj.auth.oauth2.accessToken,
|
|
1656
|
+
system: true
|
|
1657
|
+
});
|
|
1658
|
+
});
|
|
1659
|
+
|
|
1660
|
+
it('should trim extra spaces in custom header prefix', function () {
|
|
1661
|
+
var clonedRequestObj,
|
|
1662
|
+
request,
|
|
1663
|
+
auth,
|
|
1664
|
+
authInterface,
|
|
1665
|
+
handler;
|
|
1666
|
+
|
|
1667
|
+
clonedRequestObj = _.cloneDeep(requestObj);
|
|
1668
|
+
clonedRequestObj.auth.oauth2.headerPrefix = ' Postman ';
|
|
1669
|
+
|
|
1670
|
+
request = new Request(clonedRequestObj);
|
|
1671
|
+
auth = request.auth;
|
|
1672
|
+
authInterface = createAuthInterface(auth);
|
|
1673
|
+
handler = AuthLoader.getHandler(auth.type);
|
|
1674
|
+
|
|
1675
|
+
handler.sign(authInterface, request, _.noop);
|
|
1676
|
+
|
|
1677
|
+
expect(request.headers.all()).to.be.an('array').that.has.lengthOf(1);
|
|
1678
|
+
expect(request.headers.toJSON()[0]).to.eql({
|
|
1679
|
+
key: 'Authorization',
|
|
1680
|
+
value: 'Postman ' + requestObj.auth.oauth2.accessToken,
|
|
1681
|
+
system: true
|
|
1682
|
+
});
|
|
1683
|
+
});
|
|
1684
|
+
|
|
1571
1685
|
it('should add empty header prefix when headerPrefix = ""', function () {
|
|
1572
1686
|
var clonedRequestObj,
|
|
1573
1687
|
request,
|
|
@@ -4,7 +4,7 @@ var expect = require('chai').expect,
|
|
|
4
4
|
collectionPackage = require('../../node_modules/postman-collection/package.json'),
|
|
5
5
|
runtime = require('../../');
|
|
6
6
|
|
|
7
|
-
describe('version', function () {
|
|
7
|
+
(typeof window === 'undefined' ? describe : describe.skip)('version', function () {
|
|
8
8
|
var moduleData = {
|
|
9
9
|
version: runtimePackage.version,
|
|
10
10
|
dependencies: {
|