postman-runtime 7.1.2 → 7.1.6

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/.nsprc CHANGED
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "exceptions": [],
3
- "exclusions": []
3
+ "exclusions": {}
4
4
  }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Postman Runtime Changelog
2
2
 
3
+ #### v7.1.6 (May 24, 2018)
4
+ * Updated dependencies
5
+ * Updated `postman-request` to `v2.86.1-postman.1`, which fixes https://nodesecurity.io/advisories/664
6
+
7
+ #### v7.1.5 (April 10, 2018)
8
+ * #565 Updated `postman-sandbox` to `v3.0.6`.
9
+
10
+ #### v7.1.4 (April 9, 2018)
11
+ * Updated dependencies :arrow_up:
12
+ * #563 Updated `postman-sandbox` to `v3.0.5`, which fixes assertion centric bugs :bug:
13
+ * #554 Updated `postman-request` to `v2.85.1-postman.1`, which fixes https://nodesecurity.io/advisories/566 :lock:.
14
+ * #553 Fixed a bug that prevented JavaScript keywords from being used as keys in request bodies. :bug:
15
+
16
+ #### v7.1.3 (January 2, 2018)
17
+ * #510 Updated `postman-request` to `v2.81.1-postman.4`, which contains a formdata `RangeError` bugfix.
18
+ * #480 Removed blacklisting of headers for aws auth. All the headers are now included in the signature calculation.
19
+
3
20
  #### v7.1.2 (December 8, 2017)
4
21
  * Updated dependencies :arrow_up:
5
22
  * #500 Fixed entrypoint detection error :bug:
@@ -9,11 +26,11 @@
9
26
  * #491 Updated entrypoint documentation :srcoll:
10
27
  * #487 Accelerated memory leack checker script :racehorse:
11
28
 
12
- ### v7.1.1 (November 30, 2017)
29
+ #### v7.1.1 (November 30, 2017)
13
30
  * Dropped support for legacy `serviceName` property in `aws` auth.
14
31
  * :arrow_up: Updated dependencies.
15
32
 
16
- ### v7.1.0 (November 21, 2017)
33
+ #### v7.1.0 (November 21, 2017)
17
34
  * Runtime now adds `system: true` to all the query parameters that it sets
18
35
  * More useful error messages for assertion failures in legacy `tests`
19
36
  * Digest auth does not attempt retries for invalid credentials/configuration. It will continue to retry for missing configuration.
@@ -35,7 +52,7 @@
35
52
  }});
36
53
  ```
37
54
 
38
- ### v7.0.1 (November 8, 2017)
55
+ #### v7.0.1 (November 8, 2017)
39
56
  * :bug: Fixed a bug where the assertions for legacy `tests` failures did not have an `error` object.
40
57
  * :arrow_up: Updated dependencies
41
58
 
@@ -1,10 +1,6 @@
1
1
  var aws4 = require('aws4'),
2
2
  _ = require('lodash'),
3
- RequestBody = require('postman-collection').RequestBody,
4
-
5
- // These auto-added headers interfere with the AWS Auth signing process.
6
- // Ideally, they're not supposed to be a part of the signature calculation
7
- NON_SIGNABLE_HEADERS = ['cache-control', 'postman-token'];
3
+ RequestBody = require('postman-collection').RequestBody;
8
4
 
9
5
  /**
10
6
  * @implements {AuthHandlerInterface}
@@ -141,21 +137,16 @@ module.exports = {
141
137
  method: request.method,
142
138
  body: request.body ? request.body.toString() : undefined,
143
139
  headers: _.transform(request.getHeaders({enabled: true}), function (accumulator, value, key) {
144
- if (!_.includes(NON_SIGNABLE_HEADERS, key.toLowerCase())) {
145
- accumulator[key] = value;
146
- }
140
+ accumulator[key] = value;
147
141
  }, {})
148
142
  });
149
143
 
150
144
  _.forEach(signedData.headers, function (value, key) {
151
- // TODO: figure out a better way of handling errors.
152
- if (!_.includes(['content-length', 'content-type', 'host'], key.toLowerCase())) {
153
- request.upsertHeader({
154
- key: key,
155
- value: value,
156
- system: true
157
- });
158
- }
145
+ request.upsertHeader({
146
+ key: key,
147
+ value: value,
148
+ system: true
149
+ });
159
150
  });
160
151
  return done();
161
152
  }
@@ -38,6 +38,39 @@ var _ = require('lodash'),
38
38
 
39
39
  GET = 'get',
40
40
 
41
+ /**
42
+ * An iterative helper to reduce formdata/urlencoded request bodies from object arrays to a singular aggregated
43
+ * object.
44
+ *
45
+ * @param {Object} accumulator - The resultant aggregated object representation for the request body.
46
+ * @param {Object} param - One of many request body elements.
47
+ * @param {Boolean} param.disabled - A flag that can be set to true to indicate the disabled status of the param.
48
+ * @param {String} param.key - The name of the current body parameter.
49
+ * @param {String} param.value - The value of the current body parameter.
50
+ * @param {String} param.description - The description associated with the current request body parameter.
51
+ * @returns {*}
52
+ */
53
+ transformRequestBody = function (accumulator, param) {
54
+ if (param.disabled) { return accumulator; }
55
+
56
+ var key = param.key,
57
+ value = param.value;
58
+
59
+ // This is actually pretty simple,
60
+ // If the variable already exists in the accumulator, we need to make the value an Array with
61
+ // all the variable values inside it.
62
+ // We can't replace the ad-hoc condition below with a sans-prototype object as an accumulator,
63
+ // since the request library needs to perform hasOwnProperty checks on the passed req body object
64
+ if (_.has(accumulator, key)) {
65
+ _.isArray(accumulator[key]) ? accumulator[key].push(value) :
66
+ (accumulator[key] = [accumulator[key], value]);
67
+ }
68
+ else {
69
+ accumulator[param.key] = param.value;
70
+ }
71
+ return accumulator;
72
+ },
73
+
41
74
  /**
42
75
  * Abstracts out the logic for domain resolution
43
76
  * @param options
@@ -296,40 +329,12 @@ module.exports = {
296
329
  }
297
330
  else if (mode === REQUEST_MODES.URLENCODED) {
298
331
  computedBody = {
299
- form: _.reduce(content, function (accumulator, param) {
300
- if (param.disabled) { return accumulator; }
301
-
302
- // This is actually pretty simple,
303
- // If the variable already exists in the accumulator, we need to make the value an Array with
304
- // all the variable values inside it.
305
- if (accumulator[param.key]) {
306
- _.isArray(accumulator[param.key]) ? accumulator[param.key].push(param.value) :
307
- (accumulator[param.key] = [accumulator[param.key], param.value]);
308
- }
309
- else {
310
- accumulator[param.key] = param.value;
311
- }
312
- return accumulator;
313
- }, {})
332
+ form: _.reduce(content, transformRequestBody, {})
314
333
  };
315
334
  }
316
335
  else if (request.body.mode === REQUEST_MODES.FORMDATA) {
317
336
  computedBody = {
318
- formData: _.reduce(content, function (accumulator, param) {
319
- if (param.disabled) { return accumulator; }
320
-
321
- // This is actually pretty simple,
322
- // If the variable already exists in the accumulator, we need to make the value an Array with
323
- // all the variable values inside it.
324
- if (accumulator[param.key]) {
325
- _.isArray(accumulator[param.key]) ? accumulator[param.key].push(param.value) :
326
- (accumulator[param.key] = [accumulator[param.key], param.value]);
327
- }
328
- else {
329
- accumulator[param.key] = param.value;
330
- }
331
- return accumulator;
332
- }, {})
337
+ formData: _.reduce(content, transformRequestBody, {})
333
338
  };
334
339
  }
335
340
  else if (request.body.mode === REQUEST_MODES.FILE) {
@@ -1,5 +1,5 @@
1
1
  var _ = require('lodash'),
2
- util = require('./util'),
2
+ core = require('./core'),
3
3
  Emitter = require('events'),
4
4
  inherits = require('inherits'),
5
5
  sdk = require('postman-collection'),
@@ -116,12 +116,12 @@ _.assign(Requester.prototype, /** @lends Requester.prototype */ {
116
116
  }
117
117
 
118
118
  cookieJar = self.options.cookieJar;
119
- requestOptions = util.getRequestOptions(request, self.options);
119
+ requestOptions = core.getRequestOptions(request, self.options);
120
120
  startTime = Date.now();
121
121
  hostname = request.url.getHost();
122
122
 
123
123
  // check if host is on the `restrictedAddresses`
124
- if (networkOptions.restrictedAddresses && util.isAddressRestricted(hostname, networkOptions)) {
124
+ if (networkOptions.restrictedAddresses && core.isAddressRestricted(hostname, networkOptions)) {
125
125
  return complete(new Error(ERROR_RESTRICTED_ADDRESS + hostname));
126
126
  }
127
127
 
@@ -143,14 +143,14 @@ _.assign(Requester.prototype, /** @lends Requester.prototype */ {
143
143
  responseString = ((resBody !== null && resBody !== undefined) && resBody.toString) ?
144
144
  resBody.toString() : resBody;
145
145
  if (responseString === '[object ArrayBuffer]') {
146
- responseString = util.arrayBufferToString(resBody);
146
+ responseString = core.arrayBufferToString(resBody);
147
147
  }
148
148
 
149
149
  // Calculate the time taken for us to get the response.
150
150
  responseTime = Date.now() - startTime;
151
151
 
152
152
  // This helps us to unify the information from XHR or Node calls.
153
- responseJSON = util.jsonifyResponse(res, requestOptions, responseString);
153
+ responseJSON = core.jsonifyResponse(res, requestOptions, responseString);
154
154
 
155
155
  // Pull out cookies from the cookie jar, and make them chrome compatible.
156
156
  cookies = (cookieJar && _.isFunction(cookieJar.getCookies)) ?
@@ -60,7 +60,7 @@ module.exports = function (exit) {
60
60
  offline: false,
61
61
  package: {
62
62
  name: pkg.name,
63
- dependencies: _.omit(pkg.dependencies, nsprc.exclusions || [])
63
+ dependencies: _.omit(pkg.dependencies, _.keys(nsprc.exclusions) || [])
64
64
  }
65
65
  }, function (err, result) {
66
66
  // if processing nsp had an error, simply print that and exit
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "postman-runtime",
3
- "version": "7.1.2",
3
+ "version": "7.1.6",
4
4
  "description": "Underlying library of executing Postman Collections (used by Newman)",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -27,46 +27,46 @@
27
27
  "author": "Postman Labs <help@getpostman.com>",
28
28
  "license": "Apache-2.0",
29
29
  "dependencies": {
30
- "async": "2.6.0",
31
- "aws4": "1.6.0",
32
- "btoa": "1.1.2",
30
+ "async": "2.6.1",
31
+ "aws4": "1.7.0",
32
+ "btoa": "1.2.1",
33
33
  "crypto-js": "3.1.9-1",
34
- "eventemitter3": "3.0.0",
35
- "hawk": "3.1.3",
34
+ "eventemitter3": "3.1.0",
35
+ "hawk": "6.0.2",
36
36
  "http-reasons": "0.1.0",
37
- "httpntlm": "1.7.5",
37
+ "httpntlm": "1.7.6",
38
38
  "inherits": "2.0.3",
39
- "lodash": "4.17.4",
39
+ "lodash": "4.17.10",
40
40
  "node-oauth1": "1.2.2",
41
- "postman-collection": "3.0.6",
42
- "postman-request": "2.81.1-postman.3",
43
- "postman-sandbox": "3.0.4",
41
+ "postman-collection": "3.0.10",
42
+ "postman-request": "2.86.1-postman.1",
43
+ "postman-sandbox": "3.0.8",
44
44
  "resolve-from": "4.0.0",
45
- "serialised-error": "1.1.2",
46
- "uuid": "3.1.0"
45
+ "serialised-error": "1.1.3",
46
+ "uuid": "3.2.1"
47
47
  },
48
48
  "devDependencies": {
49
- "ajv": "5.5.1",
50
- "colors": "1.1.2",
49
+ "ajv": "6.5.0",
50
+ "colors": "1.3.0",
51
51
  "editorconfig": "0.15.0",
52
- "eslint": "4.12.1",
53
- "eslint-plugin-jsdoc": "3.2.0",
54
- "eslint-plugin-lodash": "2.5.0",
52
+ "eslint": "4.19.1",
53
+ "eslint-plugin-jsdoc": "3.7.1",
54
+ "eslint-plugin-lodash": "2.7.0",
55
55
  "eslint-plugin-mocha": "4.11.0",
56
56
  "eslint-plugin-security": "1.4.0",
57
57
  "expect.js": "0.3.1",
58
- "http-proxy": "1.16.2",
58
+ "http-proxy": "1.17.0",
59
59
  "istanbul": "0.4.5",
60
- "js-yaml": "3.9.1",
60
+ "js-yaml": "3.11.0",
61
61
  "jsdoc": "3.5.5",
62
- "jsdoc-to-markdown": "3.0.2",
63
- "mocha": "4.0.1",
62
+ "jsdoc-to-markdown": "4.0.1",
63
+ "mocha": "5.2.0",
64
64
  "nsp": "2.8.1",
65
65
  "parse-gitignore": "0.4.0",
66
66
  "postman-jsdoc-theme": "0.0.3",
67
- "recursive-readdir": "2.2.1",
68
- "shelljs": "0.7.8",
69
- "sinon": "4.1.3",
67
+ "recursive-readdir": "2.2.2",
68
+ "shelljs": "0.8.2",
69
+ "sinon": "5.0.10",
70
70
  "tmp": "0.0.33"
71
71
  },
72
72
  "browser": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "http://json-schema.org/draft-06/schema#",
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
3
  "type": "object",
4
4
  "required": ["info", "updates"],
5
5
  "properties": {
@@ -40,7 +40,7 @@ describe('Hawk authentication', function () {
40
40
 
41
41
  var response = testrun.request.getCall(0).args[2];
42
42
  expect(response.code).to.eql(200);
43
- expect(response.json().status).to.eql('pass');
43
+ expect(response.json().message).to.eql('Hawk Authentication Successful');
44
44
  });
45
45
 
46
46
  it('must have completed the run', function () {
@@ -29,7 +29,7 @@ describe('nsp', function () {
29
29
  });
30
30
 
31
31
  it('must exclude only a known set of packages', function () {
32
- expect(nsprc.exclusions).to.eql([]);
32
+ expect(nsprc.exclusions).to.eql({});
33
33
  });
34
34
 
35
35
  // if you are changing the version here, most probably you are better of removing the exclusion in first place.
@@ -66,9 +66,9 @@ describe('project repository', function () {
66
66
  expect(json.dependencies).to.be.a('object');
67
67
  });
68
68
 
69
- // Hawk library v3.1.2+ uses ES6 and is not compatible with the browser.
69
+ // Hawk library v6.0.2+ uses ES2017 and is not compatible with Node <8.
70
70
  it('hawk version', function () {
71
- expect(json.dependencies.hawk).to.be('3.1.3');
71
+ expect(json.dependencies.hawk).to.be('6.0.2');
72
72
  });
73
73
 
74
74
  it('must point to a valid semver', function () {
@@ -3,7 +3,7 @@
3
3
  var expect = require('expect.js'),
4
4
  sdk = require('postman-collection'),
5
5
  runtimeVersion = require('../../package').version,
6
- requesterUtil = require('../../lib/requester/util');
6
+ requesterCore = require('../../lib/requester/core');
7
7
 
8
8
  describe('requester util', function () {
9
9
  describe('.getRequestOptions', function () {
@@ -21,7 +21,7 @@ describe('requester util', function () {
21
21
  }
22
22
  });
23
23
 
24
- expect(requesterUtil.getRequestOptions(request, {})).to.eql({
24
+ expect(requesterCore.getRequestOptions(request, {})).to.eql({
25
25
  headers: {
26
26
  alpha: 'foo',
27
27
  'User-Agent': 'PostmanRuntime/' + runtimeVersion,
@@ -54,7 +54,7 @@ describe('requester util', function () {
54
54
  }]
55
55
  });
56
56
 
57
- expect(requesterUtil.getRequestOptions(request, {})).to.eql({
57
+ expect(requesterCore.getRequestOptions(request, {})).to.eql({
58
58
  headers: {
59
59
  alpha: 'foo',
60
60
  'User-Agent': 'PostmanRuntime/' + runtimeVersion,
@@ -80,7 +80,7 @@ describe('requester util', function () {
80
80
  url: 'http://localhost:8080/random/path'
81
81
  });
82
82
 
83
- expect(requesterUtil.getRequestOptions(request, {}).lookup).to.be.a('function');
83
+ expect(requesterCore.getRequestOptions(request, {}).lookup).to.be.a('function');
84
84
  });
85
85
 
86
86
  it('should override lookup function for restricted addresses', function () {
@@ -95,7 +95,7 @@ describe('requester util', function () {
95
95
  }
96
96
  };
97
97
 
98
- expect(requesterUtil.getRequestOptions(request, options).lookup).to.be.a('function');
98
+ expect(requesterCore.getRequestOptions(request, options).lookup).to.be.a('function');
99
99
  });
100
100
 
101
101
  it('should override lookup function for hosts', function () {
@@ -110,7 +110,7 @@ describe('requester util', function () {
110
110
  }
111
111
  };
112
112
 
113
- expect(requesterUtil.getRequestOptions(request, options).lookup).to.be.a('function');
113
+ expect(requesterCore.getRequestOptions(request, options).lookup).to.be.a('function');
114
114
  });
115
115
  });
116
116
 
@@ -118,21 +118,21 @@ describe('requester util', function () {
118
118
  it('should not mutate the header if it already exists', function () {
119
119
  var headers = {alpha: 'foo', beta: 'bar'};
120
120
 
121
- requesterUtil.ensureHeaderExists(headers, 'alpha');
121
+ requesterCore.ensureHeaderExists(headers, 'alpha');
122
122
  expect(headers).to.eql({alpha: 'foo', beta: 'bar'});
123
123
  });
124
124
 
125
125
  it('should correctly set a missing header', function () {
126
126
  var headers = {alpha: 'foo', beta: 'bar'};
127
127
 
128
- requesterUtil.ensureHeaderExists(headers, 'gamma', 'baz');
128
+ requesterCore.ensureHeaderExists(headers, 'gamma', 'baz');
129
129
  expect(headers).to.eql({alpha: 'foo', beta: 'bar', gamma: 'baz'});
130
130
  });
131
131
  });
132
132
 
133
133
  describe('.getRequestHeaders', function () {
134
134
  it('should handle invalid input correctly', function () {
135
- var result = requesterUtil.getRequestHeaders({});
135
+ var result = requesterCore.getRequestHeaders({});
136
136
  expect(result).to.be(undefined);
137
137
  });
138
138
 
@@ -149,7 +149,7 @@ describe('requester util', function () {
149
149
  {key: '', value: 'random'}
150
150
  ]
151
151
  }),
152
- headers = requesterUtil.getRequestHeaders(request);
152
+ headers = requesterCore.getRequestHeaders(request);
153
153
 
154
154
  expect(headers).to.eql({
155
155
  alpha: ['foo', 'next', 'other'],
@@ -166,7 +166,7 @@ describe('requester util', function () {
166
166
  body: {mode: 'formdata'}
167
167
  });
168
168
 
169
- expect(requesterUtil.getRequestBody(request)).to.be(undefined);
169
+ expect(requesterCore.getRequestBody(request)).to.be(undefined);
170
170
  });
171
171
 
172
172
  it('should correctly handle missing bodies', function () {
@@ -175,7 +175,7 @@ describe('requester util', function () {
175
175
  method: 'POST'
176
176
  });
177
177
 
178
- expect(requesterUtil.getRequestBody(request)).to.be(undefined);
178
+ expect(requesterCore.getRequestBody(request)).to.be(undefined);
179
179
  });
180
180
 
181
181
  it('should correctly handle missing request methods', function () {
@@ -195,7 +195,7 @@ describe('requester util', function () {
195
195
  });
196
196
 
197
197
  delete request.method;
198
- expect(requesterUtil.getRequestBody(request, {})).to.eql({
198
+ expect(requesterCore.getRequestBody(request, {})).to.eql({
199
199
  formData: {foo: 'bar'}
200
200
  });
201
201
  });
@@ -212,7 +212,7 @@ describe('requester util', function () {
212
212
  }
213
213
  });
214
214
 
215
- expect(requesterUtil.getRequestBody(request, {sendBodyWithGetRequests: true})).to.eql({
215
+ expect(requesterCore.getRequestBody(request, {sendBodyWithGetRequests: true})).to.eql({
216
216
  formData: {foo: 'bar'}
217
217
  });
218
218
  });
@@ -227,7 +227,7 @@ describe('requester util', function () {
227
227
  }
228
228
  });
229
229
 
230
- expect(requesterUtil.getRequestBody(request)).to.eql({
230
+ expect(requesterCore.getRequestBody(request)).to.eql({
231
231
  body: '{"beta":"bar"}'
232
232
  });
233
233
  });
@@ -248,7 +248,7 @@ describe('requester util', function () {
248
248
  }
249
249
  });
250
250
 
251
- expect(requesterUtil.getRequestBody(request)).to.eql({
251
+ expect(requesterCore.getRequestBody(request)).to.eql({
252
252
  form: {alpha: ['foo', 'other', 'next'], beta: 'bar'}
253
253
  });
254
254
  });
@@ -269,7 +269,7 @@ describe('requester util', function () {
269
269
  }
270
270
  });
271
271
 
272
- expect(requesterUtil.getRequestBody(request)).to.eql({
272
+ expect(requesterCore.getRequestBody(request)).to.eql({
273
273
  formData: {alpha: ['foo', 'other', 'next'], beta: 'bar'}
274
274
  });
275
275
  });
@@ -284,7 +284,7 @@ describe('requester util', function () {
284
284
  }
285
285
  });
286
286
 
287
- expect(requesterUtil.getRequestBody(request)).to.have.property('body');
287
+ expect(requesterCore.getRequestBody(request)).to.have.property('body');
288
288
  });
289
289
 
290
290
  it('should handle arbitrary request bodies correctly', function () {
@@ -297,29 +297,115 @@ describe('requester util', function () {
297
297
  }
298
298
  });
299
299
 
300
- expect(requesterUtil.getRequestBody(request)).to.be(undefined);
300
+ expect(requesterCore.getRequestBody(request)).to.be(undefined);
301
+ });
302
+
303
+ describe('request bodies with special keywords', function () {
304
+ describe('formdata', function () {
305
+ it('should handle request bodies with whitelisted special keywords correctly', function () {
306
+ var request = new sdk.Request({
307
+ url: 'postman-echo.com/post',
308
+ method: 'POST',
309
+ body: {
310
+ mode: 'formdata',
311
+ formdata: [
312
+ {key: 'constructor', value: 'builds away!'},
313
+ {key: 'foo', value: 'bar'}
314
+ ]
315
+ }
316
+ });
317
+
318
+ expect(requesterCore.getRequestBody(request)).to.eql({
319
+ formData: {constructor: 'builds away!', foo: 'bar'}
320
+ });
321
+ });
322
+
323
+ it('should handle request bodies with multiple whitelisted special keywords correctly', function () {
324
+ var request = new sdk.Request({
325
+ url: 'postman-echo.com/post',
326
+ method: 'POST',
327
+ body: {
328
+ mode: 'formdata',
329
+ formdata: [
330
+ {key: 'constructor', value: 'I\'ll be back'},
331
+ {key: 'constructor', value: 'Come with me if you want to live!'},
332
+ {key: 'foo', value: 'bar'}
333
+ ]
334
+ }
335
+ });
336
+
337
+ expect(requesterCore.getRequestBody(request)).to.eql({
338
+ formData: {
339
+ constructor: ['I\'ll be back', 'Come with me if you want to live!'],
340
+ foo: 'bar'
341
+ }
342
+ });
343
+ });
344
+ });
345
+
346
+ describe('url encoded', function () {
347
+ it('should handle request bodies with whitelisted special keywords correctly', function () {
348
+ var request = new sdk.Request({
349
+ url: 'postman-echo.com/post',
350
+ method: 'POST',
351
+ body: {
352
+ mode: 'urlencoded',
353
+ urlencoded: [
354
+ {key: 'constructor', value: 'builds away!'},
355
+ {key: 'foo', value: 'bar'}
356
+ ]
357
+ }
358
+ });
359
+
360
+ expect(requesterCore.getRequestBody(request)).to.eql({
361
+ form: {constructor: 'builds away!', foo: 'bar'}
362
+ });
363
+ });
364
+
365
+ it('should handle request bodies with multiple whitelisted special keywords correctly', function () {
366
+ var request = new sdk.Request({
367
+ url: 'postman-echo.com/post',
368
+ method: 'POST',
369
+ body: {
370
+ mode: 'urlencoded',
371
+ urlencoded: [
372
+ {key: 'constructor', value: 'I\'ll be back'},
373
+ {key: 'constructor', value: 'Come with me if you want to live!'},
374
+ {key: 'foo', value: 'bar'}
375
+ ]
376
+ }
377
+ });
378
+
379
+ expect(requesterCore.getRequestBody(request)).to.eql({
380
+ form: {
381
+ constructor: ['I\'ll be back', 'Come with me if you want to live!'],
382
+ foo: 'bar'
383
+ }
384
+ });
385
+ });
386
+ });
301
387
  });
302
388
  });
303
389
 
304
390
  describe('.jsonifyResponse', function () {
305
391
  it('should handle falsy input correctly', function () {
306
- expect(requesterUtil.jsonifyResponse()).to.be(undefined);
392
+ expect(requesterCore.jsonifyResponse()).to.be(undefined);
307
393
  });
308
394
  });
309
395
 
310
396
  describe('.arrayPairsToObject', function () {
311
397
  it('should bail out for non-arrays', function () {
312
- var result = requesterUtil.arrayPairsToObject('random');
398
+ var result = requesterCore.arrayPairsToObject('random');
313
399
  expect(result).to.be(undefined);
314
400
  });
315
401
 
316
402
  it('should correctly convert an array of pairs to an object', function () {
317
- var obj = requesterUtil.arrayPairsToObject(['a', 'b', 'c', 'd']);
403
+ var obj = requesterCore.arrayPairsToObject(['a', 'b', 'c', 'd']);
318
404
  expect(obj).to.eql({a: 'b', c: 'd'});
319
405
  });
320
406
 
321
407
  it('should correctly handle multi valued keys', function () {
322
- var obj = requesterUtil.arrayPairsToObject(['a', 'b', 'c', 'd', 'a', 'e']);
408
+ var obj = requesterCore.arrayPairsToObject(['a', 'b', 'c', 'd', 'a', 'e']);
323
409
  expect(obj).to.eql({a: ['b', 'e'], c: 'd'});
324
410
  });
325
411
  });
package/.npmignore DELETED
@@ -1,41 +0,0 @@
1
- # PLATFORM
2
- # ========
3
- # All exclusions that are specific to the NPM, GIT, IDE and Operating Systems.
4
-
5
- # - Do not allow installed node modules to be committed. Doing `npm install -d` will bring them in root or other places.
6
- node_modules
7
-
8
- # - Do not commit any log file from anywhere
9
- *.log
10
- *.log.*
11
-
12
- # - Prevent addition of OS specific file explorer files
13
- Thumbs.db
14
- .DS_Store
15
-
16
- # Prevent IDE stuff
17
- .idea
18
- .vscode
19
-
20
- # PROJECT
21
- # =======
22
- # Configuration pertaining to project specific repository structure.
23
-
24
- # - Prevent Sublime text IDE files from being commited to repository
25
- *.sublime-*
26
-
27
- # - Allow sublime text project file to be commited in the development directory.
28
- !/develop/*.sublime-project
29
-
30
- # - Prevent CI output files from being Added
31
- /out/
32
-
33
- # - Prevent diff backups from SourceTree from showing as commit.
34
- *.BACKUP.*
35
- *.BASE.*
36
- *.LOCAL.*
37
- *.REMOTE.*
38
- *.orig
39
-
40
- # - Prevent unit test coverage reports from being committed to the repository
41
- .coverage