Skip to content

Commit 5386053

Browse files
authoredJan 18, 2024
Merge pull request #727 from postmanlabs/release/v1.9.0
Release version v1.9.0
2 parents 2427014 + c5aeaa7 commit 5386053

File tree

12 files changed

+189
-85
lines changed

12 files changed

+189
-85
lines changed
 

‎CHANGELOG.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
## [Unreleased]
44

5+
## [v1.9.0] - 2024-01-18
6+
7+
### Fixed
8+
9+
- Fix for - [#10139](https://github.com/postmanlabs/postman-app-support/issues/10139) Modify Swift codegen to work with multipart/form-data format, used for video file upload
10+
511
## [v1.8.0] - 2023-06-27
612

713
- Fix for - [#10521](https://github.com/postmanlabs/postman-app-support/issues/10521) Add support for Dart Dio snippet generation
@@ -140,7 +146,9 @@ v1.0.0 (May 29, 2020)
140146
- Add ES6 syntax support for NodeJS Request, NodeJS Native and NodeJS Unirest
141147
- Fix snippet generation for powershell and jquery, where form data params had no type field
142148

143-
[Unreleased]: https://github.com/postmanlabs/postman-code-generators/compare/v1.8.0...HEAD
149+
[Unreleased]: https://github.com/postmanlabs/postman-code-generators/compare/v1.9.0...HEAD
150+
151+
[v1.9.0]: https://github.com/postmanlabs/postman-code-generators/compare/v1.8.0...v1.9.0
144152

145153
[v1.8.0]: https://github.com/postmanlabs/postman-code-generators/compare/v1.7.2...v1.8.0
146154

‎codegens/js-fetch/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Convert function takes three parameters
1919
* `trimRequestBody` - Trim request body fields
2020
* `followRedirect` - Boolean denoting whether to redirect a request
2121
* `requestTimeout` - Integer denoting time after which the request will bail out in milli-seconds
22+
* `asyncAwaitEnabled` : Boolean denoting whether to use async/await syntax
2223

2324
* `callback` - callback function with first parameter as error and second parameter as string for code snippet
2425

‎codegens/js-fetch/lib/index.js

+45-26
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function redirectMode (redirect) {
2424
* @param {boolean} trim trim body option
2525
*/
2626
function parseURLEncodedBody (body, trim) {
27-
var bodySnippet = 'var urlencoded = new URLSearchParams();\n';
27+
var bodySnippet = 'const urlencoded = new URLSearchParams();\n';
2828
_.forEach(body, function (data) {
2929
if (!data.disabled) {
3030
bodySnippet += `urlencoded.append("${sanitize(data.key, trim)}", "${sanitize(data.value, trim)}");\n`;
@@ -40,7 +40,7 @@ function parseURLEncodedBody (body, trim) {
4040
* @param {boolean} trim trim body option
4141
*/
4242
function parseFormData (body, trim) {
43-
var bodySnippet = 'var formdata = new FormData();\n';
43+
var bodySnippet = 'const formdata = new FormData();\n';
4444
_.forEach(body, function (data) {
4545
if (!data.disabled) {
4646
if (data.type === 'file') {
@@ -65,7 +65,7 @@ function parseFormData (body, trim) {
6565
* @param {String} indentString Indentation string
6666
*/
6767
function parseRawBody (body, trim, contentType, indentString) {
68-
var bodySnippet = 'var raw = ';
68+
var bodySnippet = 'const raw = ';
6969
// Match any application type whose underlying structure is json
7070
// For example application/vnd.api+json
7171
// All of them have +json as suffix
@@ -101,7 +101,7 @@ function parseGraphQL (body, trim, indentString) {
101101
catch (e) {
102102
graphqlVariables = {};
103103
}
104-
bodySnippet = 'var graphql = JSON.stringify({\n';
104+
bodySnippet = 'const graphql = JSON.stringify({\n';
105105
bodySnippet += `${indentString}query: "${sanitize(query, trim)}",\n`;
106106
bodySnippet += `${indentString}variables: ${JSON.stringify(graphqlVariables)}\n})`;
107107
return bodySnippet;
@@ -113,7 +113,7 @@ function parseGraphQL (body, trim, indentString) {
113113
* parses binamry file data
114114
*/
115115
function parseFileData () {
116-
var bodySnippet = 'var file = "<file contents here>";\n';
116+
var bodySnippet = 'const file = "<file contents here>";\n';
117117
return bodySnippet;
118118
}
119119

@@ -154,7 +154,7 @@ function parseBody (body, trim, indentString, contentType) {
154154
function parseHeaders (headers) {
155155
var headerSnippet = '';
156156
if (!_.isEmpty(headers)) {
157-
headerSnippet = 'var myHeaders = new Headers();\n';
157+
headerSnippet = 'const myHeaders = new Headers();\n';
158158
headers = _.reject(headers, 'disabled');
159159
_.forEach(headers, function (header) {
160160
headerSnippet += `myHeaders.append("${sanitize(header.key, true)}", "${sanitize(header.value)}");\n`;
@@ -209,6 +209,13 @@ function getOptions () {
209209
type: 'boolean',
210210
default: false,
211211
description: 'Remove white space and additional lines that may affect the server\'s response'
212+
},
213+
{
214+
name: 'Use async/await',
215+
id: 'asyncAwaitEnabled',
216+
type: 'boolean',
217+
default: false,
218+
description: 'Modifies code snippet to use async/await'
212219
}
213220
];
214221
}
@@ -238,7 +245,6 @@ function convert (request, options, callback) {
238245
headerSnippet = '',
239246
bodySnippet = '',
240247
optionsSnippet = '',
241-
timeoutSnippet = '',
242248
fetchSnippet = '';
243249
indent = indent.repeat(options.indentCount);
244250
if (request.body && request.body.mode === 'graphql' && !request.headers.has('Content-Type')) {
@@ -294,8 +300,12 @@ function convert (request, options, callback) {
294300
body = request.body && request.body.toJSON();
295301
bodySnippet = parseBody(body, trim, indent, request.headers.get('Content-Type'));
296302

297-
optionsSnippet = `var requestOptions = {\n${indent}`;
298-
optionsSnippet += `method: '${request.method}',\n${indent}`;
303+
if (options.requestTimeout > 0) {
304+
codeSnippet += 'const controller = new AbortController();\n';
305+
codeSnippet += `const timerId = setTimeout(() => controller.abort(), ${options.requestTimeout});\n`;
306+
}
307+
optionsSnippet = `const requestOptions = {\n${indent}`;
308+
optionsSnippet += `method: "${request.method}",\n${indent}`;
299309
if (headerSnippet !== '') {
300310
optionsSnippet += `headers: myHeaders,\n${indent}`;
301311
codeSnippet += headerSnippet + '\n';
@@ -305,30 +315,39 @@ function convert (request, options, callback) {
305315
optionsSnippet += `body: ${body.mode},\n${indent}`;
306316
codeSnippet += bodySnippet + '\n';
307317
}
308-
optionsSnippet += `redirect: '${redirectMode(options.followRedirect)}'\n};\n`;
318+
if (options.requestTimeout > 0) {
319+
optionsSnippet += `signal: controller.signal,\n${indent}`;
320+
}
321+
optionsSnippet += `redirect: "${redirectMode(options.followRedirect)}"\n};\n`;
309322

310323
codeSnippet += optionsSnippet + '\n';
311324

312-
fetchSnippet = `fetch("${sanitize(request.url.toString())}", requestOptions)\n${indent}`;
313-
fetchSnippet += `.then(response => response.text())\n${indent}`;
314-
fetchSnippet += `.then(result => console.log(result))\n${indent}`;
315-
fetchSnippet += '.catch(error => console.log(\'error\', error));';
316-
317-
if (options.requestTimeout > 0) {
318-
timeoutSnippet = `var promise = Promise.race([\n${indent}`;
319-
timeoutSnippet += `fetch('${request.url.toString()}', requestOptions)\n${indent}${indent}`;
320-
timeoutSnippet += `.then(response => response.text()),\n${indent}`;
321-
timeoutSnippet += `new Promise((resolve, reject) =>\n${indent}${indent}`;
322-
timeoutSnippet += `setTimeout(() => reject(new Error('Timeout')), ${options.requestTimeout})\n${indent}`;
323-
timeoutSnippet += ')\n]);\n\n';
324-
timeoutSnippet += 'promise.then(result => console.log(result)),\n';
325-
timeoutSnippet += 'promise.catch(error => console.log(error));';
326-
codeSnippet += timeoutSnippet;
325+
if (options.asyncAwaitEnabled) {
326+
fetchSnippet += `try {\n${indent}`;
327+
fetchSnippet += `const response = await fetch("${sanitize(request.url.toString())}", requestOptions);\n${indent}`;
328+
fetchSnippet += `const result = await response.text();\n${indent}`;
329+
fetchSnippet += 'console.log(result)\n';
330+
fetchSnippet += `} catch (error) {\n${indent}`;
331+
fetchSnippet += 'console.error(error);\n';
332+
if (options.requestTimeout > 0) {
333+
fetchSnippet += `} finally {\n${indent}`;
334+
fetchSnippet += 'clearTimeout(timerId);\n';
335+
}
336+
fetchSnippet += '};';
327337
}
328338
else {
329-
codeSnippet += fetchSnippet;
339+
fetchSnippet = `fetch("${sanitize(request.url.toString())}", requestOptions)\n${indent}`;
340+
fetchSnippet += `.then((response) => response.text())\n${indent}`;
341+
fetchSnippet += `.then((result) => console.log(result))\n${indent}`;
342+
fetchSnippet += '.catch((error) => console.error(error))';
343+
if (options.requestTimeout > 0) {
344+
fetchSnippet += `\n${indent}.finally(() => clearTimeout(timerId))`;
345+
}
346+
fetchSnippet += ';';
330347
}
331348

349+
codeSnippet += fetchSnippet;
350+
332351
callback(null, codeSnippet);
333352
}
334353

‎codegens/js-fetch/test/unit/convert.test.js

+60-4
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,10 @@ describe('js-fetch convert function for test collection', function () {
2323
expect.fail(null, null, error);
2424
return;
2525
}
26-
2726
expect(snippet).to.be.a('string');
2827
snippetArray = snippet.split('\n');
2928
for (var i = 0; i < snippetArray.length; i++) {
30-
if (snippetArray[i] === 'var requestOptions = {') { line_no = i + 1; }
29+
if (snippetArray[i] === 'const requestOptions = {') { line_no = i + 1; }
3130
}
3231
expect(snippetArray[line_no].charAt(0)).to.equal(' ');
3332
expect(snippetArray[line_no].charAt(1)).to.equal(' ');
@@ -95,7 +94,7 @@ describe('js-fetch convert function for test collection', function () {
9594
return;
9695
}
9796
expect(snippet).to.be.a('string');
98-
expect(snippet).to.include('redirect: \'manual\'');
97+
expect(snippet).to.include('redirect: "manual"');
9998
});
10099
});
101100

@@ -111,7 +110,7 @@ describe('js-fetch convert function for test collection', function () {
111110
return;
112111
}
113112
expect(snippet).to.be.a('string');
114-
expect(snippet).to.include('redirect: \'follow\'');
113+
expect(snippet).to.include('redirect: "follow"');
115114
});
116115
});
117116

@@ -298,6 +297,62 @@ describe('js-fetch convert function for test collection', function () {
298297
expect(snippet).to.include('fetch("https://postman-echo.com/get?query1=b\'b&query2=c\\"c"');
299298
});
300299
});
300+
301+
it('should return snippet with promise based code when async_await is disabled', function () {
302+
const request = new sdk.Request(mainCollection.item[0].request);
303+
304+
convert(request, {}, function (error, snippet) {
305+
if (error) {
306+
expect.fail(null, null, error);
307+
}
308+
expect(snippet).to.be.a('string');
309+
expect(snippet).to.include('fetch(');
310+
expect(snippet).to.include('.then((response) => ');
311+
expect(snippet).to.include('.catch((error) => ');
312+
});
313+
});
314+
315+
it('should return snippet with async/await based code when option is enabled', function () {
316+
const request = new sdk.Request(mainCollection.item[0].request);
317+
318+
convert(request, { asyncAwaitEnabled: true }, function (error, snippet) {
319+
if (error) {
320+
expect.fail(null, null, error);
321+
}
322+
expect(snippet).to.be.a('string');
323+
expect(snippet).to.include('const response = await fetch(');
324+
expect(snippet).to.include('const result = await response.text()');
325+
expect(snippet).to.include('catch (error) {');
326+
});
327+
});
328+
329+
it('should return timeout snippet with promise based code when async_await is disabled', function () {
330+
const request = new sdk.Request(mainCollection.item[0].request);
331+
332+
convert(request, { requestTimeout: 3000 }, function (error, snippet) {
333+
if (error) {
334+
expect.fail(null, null, error);
335+
}
336+
expect(snippet).to.be.a('string');
337+
expect(snippet).to.include('const controller');
338+
expect(snippet).to.include('const timerId');
339+
expect(snippet).to.include('.finally(() => clearTimeout(timerId))');
340+
});
341+
});
342+
343+
it('should return timeout snippet with promise based code when async_await is enabled', function () {
344+
const request = new sdk.Request(mainCollection.item[0].request);
345+
346+
convert(request, { requestTimeout: 3000, asyncAwaitEnabled: true }, function (error, snippet) {
347+
if (error) {
348+
expect.fail(null, null, error);
349+
}
350+
expect(snippet).to.be.a('string');
351+
expect(snippet).to.include('const controller');
352+
expect(snippet).to.include('const timerId');
353+
expect(snippet).to.include('} finally {');
354+
});
355+
});
301356
});
302357

303358
describe('getOptions function', function () {
@@ -312,6 +367,7 @@ describe('js-fetch convert function for test collection', function () {
312367
expect(getOptions()[2]).to.have.property('id', 'requestTimeout');
313368
expect(getOptions()[3]).to.have.property('id', 'followRedirect');
314369
expect(getOptions()[4]).to.have.property('id', 'trimRequestBody');
370+
expect(getOptions()[5]).to.have.property('id', 'asyncAwaitEnabled');
315371
});
316372
});
317373

‎codegens/libcurl/lib/index.js

+3
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,9 @@ self = module.exports = {
214214
if (body.mode === 'formdata' && options.useMimeType) {
215215
snippet += indentString + 'curl_mime_free(mime);\n';
216216
}
217+
if (headersData) {
218+
snippet += indentString + 'curl_slist_free_all(headers);\n';
219+
}
217220
snippet += '}\n';
218221
snippet += 'curl_easy_cleanup(curl);\n';
219222
(options.includeBoilerplate) &&

‎codegens/libcurl/test/unit/convert.test.js

+32
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,38 @@ describe('libcurl convert function', function () {
145145
expect(snippet).to.include('curl_mime_name(part, "invalid src");');
146146
});
147147
});
148+
149+
it('should free up headers list after request is sent', function () {
150+
var request = new sdk.Request({
151+
'method': 'GET',
152+
'header': [
153+
{
154+
'key': 'Accept',
155+
'value': 'application/json'
156+
},
157+
{
158+
'key': 'Content-Type',
159+
'value': 'application/json'
160+
}
161+
],
162+
'url': {
163+
'raw': 'https://google.com',
164+
'protocol': 'https',
165+
'host': [
166+
'google',
167+
'com'
168+
]
169+
}
170+
});
171+
convert(request, {}, function (error, snippet) {
172+
if (error) {
173+
expect.fail(null, null, error);
174+
}
175+
expect(snippet).to.be.a('string');
176+
expect(snippet).to.include('curl_slist_free_all(headers)');
177+
});
178+
});
179+
148180
});
149181

150182
describe('getOptions function', function () {

‎codegens/swift/lib/swift.js

+17-12
Original file line numberDiff line numberDiff line change
@@ -111,29 +111,34 @@ function parseFormData (body, mode, trim, indent) {
111111
parameters = '[\n' + _.join(parameters, ',\n') + ']';
112112
bodySnippet = `let parameters = ${parameters} as [[String: Any]]\n\n`;
113113
bodySnippet += 'let boundary = "Boundary-\\(UUID().uuidString)"\n';
114-
bodySnippet += 'var body = ""\nvar error: Error? = nil\n';
114+
bodySnippet += 'var body = Data()\nvar error: Error? = nil\n';
115115
bodySnippet += 'for param in parameters {\n';
116116
bodySnippet += `${indent}if param["disabled"] != nil { continue }\n`;
117117
bodySnippet += `${indent}let paramName = param["key"]!\n`;
118-
bodySnippet += `${indent}body += "--\\(boundary)\\r\\n"\n`;
118+
bodySnippet += `${indent}body += Data("--\\(boundary)\\r\\n".utf8)\n`;
119119
// eslint-disable-next-line no-useless-escape
120-
bodySnippet += `${indent}body += "Content-Disposition:form-data; name=\\"\\(paramName)\\"\"\n`;
120+
bodySnippet += `${indent}body += Data("Content-Disposition:form-data; name=\\"\\(paramName)\\"\".utf8)\n`;
121121
bodySnippet += `${indent}if param["contentType"] != nil {\n`;
122-
bodySnippet += `${indent.repeat(2)}body += "\\r\\nContent-Type: \\(param["contentType"] as! String)"\n`;
122+
bodySnippet += `${indent.repeat(2)}body += Data("\\r\\nContent-Type: \\(param["contentType"] as! String)".utf8)\n`;
123123
bodySnippet += `${indent}}\n`;
124124
bodySnippet += `${indent}let paramType = param["type"] as! String\n`;
125125
bodySnippet += `${indent}if paramType == "text" {\n`;
126126
bodySnippet += `${indent.repeat(2)}let paramValue = param["value"] as! String\n`;
127-
bodySnippet += `${indent.repeat(2)}body += "\\r\\n\\r\\n\\(paramValue)\\r\\n"\n`;
127+
bodySnippet += `${indent.repeat(2)}body += Data("\\r\\n\\r\\n\\(paramValue)\\r\\n".utf8)\n`;
128128
bodySnippet += `${indent}} else {\n`;
129129
bodySnippet += `${indent.repeat(2)}let paramSrc = param["src"] as! String\n`;
130-
bodySnippet += `${indent.repeat(2)}let fileData = try NSData(contentsOfFile: paramSrc, options: []) as Data\n`;
131-
bodySnippet += `${indent.repeat(2)}let fileContent = String(data: fileData, encoding: .utf8)!\n`;
132-
bodySnippet += `${indent.repeat(2)}body += "; filename=\\"\\(paramSrc)\\"\\r\\n"\n`;
133-
bodySnippet += `${indent.repeat(2)} + "Content-Type: \\"content-type header\\"\\r\\n\\r\\n`;
134-
bodySnippet += '\\(fileContent)\\r\\n"\n';
135-
bodySnippet += `${indent}}\n}\nbody += "--\\(boundary)--\\r\\n";\n`;
136-
bodySnippet += 'let postData = body.data(using: .utf8)';
130+
bodySnippet += `${indent.repeat(2)}let fileURL = URL(fileURLWithPath: paramSrc)\n`;
131+
bodySnippet += `${indent.repeat(2)}if let fileContent = try? Data(contentsOf: fileURL) {\n`;
132+
bodySnippet += `${indent.repeat(3)}body += Data("; filename=\\"\\(paramSrc)\\"\\r\\n".utf8)\n`;
133+
bodySnippet += `${indent.repeat(3)}body += Data("Content-Type: \\"content-type header\\"\\r\\n".utf8)\n`;
134+
bodySnippet += `${indent.repeat(3)}body += Data("\\r\\n".utf8)\n`;
135+
bodySnippet += `${indent.repeat(3)}body += fileContent\n`;
136+
bodySnippet += `${indent.repeat(3)}body += Data("\\r\\n".utf8)\n`;
137+
bodySnippet += `${indent.repeat(2)}}\n`;
138+
bodySnippet += `${indent}}\n`;
139+
bodySnippet += '}\n';
140+
bodySnippet += 'body += Data("--\\(boundary)--\\r\\n".utf8);\n';
141+
bodySnippet += 'let postData = body\n';
137142
return bodySnippet;
138143
}
139144

‎codegens/swift/test/unit/convert.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ describe('Swift Converter', function () {
6262
}
6363
expect(snippet).to.be.a('string');
6464
expect(snippet).to.contain('if param["contentType"] != nil {');
65-
expect(snippet).to.contain('body += "\\r\\nContent-Type: \\(param["contentType"] as! String)"');
65+
expect(snippet).to.contain('body += Data("\\r\\nContent-Type: \\(param["contentType"] as! String)".utf8)');
6666
});
6767
});
6868

‎package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "postman-code-generators",
3-
"version": "1.8.0",
3+
"version": "1.9.0",
44
"description": "Generates code snippets for a postman collection",
55
"main": "index.js",
66
"directories": {

‎test/codegen/newman/fixtures/basicCollection.json

+10-29
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"info": {
3-
"_postman_id": "f52ee07d-6345-4220-89af-e6696b3c0122",
3+
"_postman_id": "b303fb8b-9b21-4429-b00f-33b6a7efa186",
44
"name": "Basic Collection",
55
"description": "This collection contains requests that will be used to test validity of plugin created to convert postman request into code snippet of particular language.",
66
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
@@ -12,7 +12,6 @@
1212
{
1313
"listen": "test",
1414
"script": {
15-
"id": "34edbfa7-7d32-42d6-8397-af2378c3aaa4",
1615
"exec": [
1716
""
1817
],
@@ -53,7 +52,6 @@
5352
},
5453
{
5554
"name": "Request Headers",
56-
"event": [],
5755
"request": {
5856
"method": "GET",
5957
"header": [
@@ -95,7 +93,6 @@
9593
{
9694
"listen": "test",
9795
"script": {
98-
"id": "e150d55b-0273-430a-9e1d-11969b433734",
9996
"exec": [
10097
""
10198
],
@@ -141,7 +138,6 @@
141138
{
142139
"listen": "test",
143140
"script": {
144-
"id": "1bfe1fc3-c244-4a42-83c5-1a0d94d56ffd",
145141
"exec": [
146142
""
147143
],
@@ -188,7 +184,6 @@
188184
{
189185
"listen": "test",
190186
"script": {
191-
"id": "a3ddecd1-e89d-426d-995c-0d6a678caa91",
192187
"exec": [
193188
"var responseJSON;",
194189
"",
@@ -216,8 +211,7 @@
216211
"header": [
217212
{
218213
"key": "Content-Type",
219-
"value": "text/plain",
220-
"disabled": false
214+
"value": "text/plain"
221215
}
222216
],
223217
"body": {
@@ -245,7 +239,6 @@
245239
{
246240
"listen": "test",
247241
"script": {
248-
"id": "e926912d-1c99-4c54-9b53-91c8f63acef0",
249242
"exec": [
250243
""
251244
],
@@ -312,7 +305,6 @@
312305
{
313306
"listen": "test",
314307
"script": {
315-
"id": "d211bdad-60b3-4cd6-869f-853377bf03ef",
316308
"exec": [
317309
""
318310
],
@@ -353,7 +345,6 @@
353345
{
354346
"listen": "test",
355347
"script": {
356-
"id": "532fef57-48fd-4ffe-ac7e-f5a7e32facc2",
357348
"exec": [
358349
""
359350
],
@@ -394,7 +385,6 @@
394385
{
395386
"listen": "test",
396387
"script": {
397-
"id": "8bbbbc5b-2983-4979-8347-3ced95a69f7e",
398388
"exec": [
399389
""
400390
],
@@ -435,7 +425,6 @@
435425
{
436426
"listen": "test",
437427
"script": {
438-
"id": "48da0505-470f-4cf3-bb77-30665415af60",
439428
"exec": [
440429
""
441430
],
@@ -618,7 +607,6 @@
618607
{
619608
"listen": "test",
620609
"script": {
621-
"type": "text/javascript",
622610
"exec": [
623611
"var responseJSON;",
624612
"",
@@ -634,28 +622,23 @@
634622
"",
635623
"tests['response has PUT data'] = _.has(responseJSON, 'data');",
636624
"tests['response matches the data sent in request'] = (responseJSON.data && responseJSON.data.length === 256);"
637-
]
625+
],
626+
"type": "text/javascript"
638627
}
639628
}
640629
],
641630
"request": {
642631
"method": "DELETE",
643-
"header": [
644-
{
645-
"key": "Content-Type",
646-
"value": "text/plain"
647-
}
648-
],
649-
"body": {},
632+
"header": [],
650633
"url": {
651-
"raw": "https://mockbin.org/request",
634+
"raw": "https://postman-echo.com/delete",
652635
"protocol": "https",
653636
"host": [
654-
"mockbin",
655-
"org"
637+
"postman-echo",
638+
"com"
656639
],
657640
"path": [
658-
"request"
641+
"delete"
659642
]
660643
},
661644
"description": "The HTTP `DELETE` method is used to delete resources on a server. The exact\nuse of `DELETE` requests depends on the server implementation. In general, \n`DELETE` requests support both, Query String parameters as well as a Request \nBody.\n\nThis endpoint accepts an HTTP `DELETE` request and provides debug information\nsuch as the HTTP headers, Query String arguments, and the Request Body."
@@ -667,7 +650,6 @@
667650
{
668651
"listen": "prerequest",
669652
"script": {
670-
"id": "e80b6162-6c90-4150-bfa1-7f42f11c8f64",
671653
"type": "text/javascript",
672654
"exec": [
673655
""
@@ -677,12 +659,11 @@
677659
{
678660
"listen": "test",
679661
"script": {
680-
"id": "538efa04-97ce-456c-a5a1-772c466591d5",
681662
"type": "text/javascript",
682663
"exec": [
683664
""
684665
]
685666
}
686667
}
687668
]
688-
}
669+
}
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,37 @@
11
{
22
"info": {
3-
"_postman_id": "3ef1c00f-c58f-4604-8419-7a4931958235",
3+
"_postman_id": "17d62db7-ca12-4298-8782-1d6f018c7be2",
44
"name": "Redirect test",
55
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
66
},
77
"item": [
88
{
99
"name": "Follow Redirects",
10+
"protocolProfileBehavior": {
11+
"followRedirects": true
12+
},
1013
"request": {
1114
"method": "GET",
1215
"header": [],
1316
"url": {
14-
"raw": "https://mockbin.org/redirect/302/1/?to=https://postman-echo.com/get",
17+
"raw": "https://httpbin.org/redirect-to?url=https://postman-echo.com/get",
1518
"protocol": "https",
1619
"host": [
17-
"mockbin",
20+
"httpbin",
1821
"org"
1922
],
2023
"path": [
21-
"redirect",
22-
"302",
23-
"1",
24-
""
24+
"redirect-to"
2525
],
2626
"query": [
2727
{
28-
"key": "to",
28+
"key": "url",
2929
"value": "https://postman-echo.com/get"
3030
}
3131
]
3232
}
3333
},
3434
"response": []
3535
}
36-
],
37-
"protocolProfileBehavior": {}
36+
]
3837
}

0 commit comments

Comments
 (0)
Please sign in to comment.