postman-code-generators
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -0,1 +1,6 @@ | ||
v1.1.1 (Nov 10, 2020) | ||
* Change string to enum in cURL quoteType option. | ||
* Fix new line issue in dart-http and HTTP codegen | ||
* Fix an issue where deepinstall was failing when folder name had spaces. | ||
v1.1.0 (Nov 2, 2020) | ||
@@ -2,0 +7,0 @@ * Added support for Dart http |
@@ -199,3 +199,3 @@ var sanitize = require('./util').sanitize, | ||
availableOptions: ['single', 'double'], | ||
type: 'string', | ||
type: 'enum', | ||
default: 'single', | ||
@@ -202,0 +202,0 @@ description: 'String denoting the quote type to use (single or double) for URL ' + |
@@ -275,6 +275,6 @@ var _ = require('./lodash'), | ||
} | ||
codeSnippet += ';\n'; | ||
codeSnippet += ';\n\n'; | ||
codeSnippet += 'if (response.statusCode == 200) {\n'; | ||
codeSnippet += `${indent}print(await response.stream.bytesToString());\n`; | ||
codeSnippet += '} else {\n'; | ||
codeSnippet += '}\nelse {\n'; | ||
codeSnippet += `${indent}print(response.reasonPhrase);\n`; | ||
@@ -281,0 +281,0 @@ codeSnippet += '}\n'; |
@@ -33,3 +33,3 @@ let utils = require('./util'), | ||
let snippet = '', | ||
url, host, path, query, body; | ||
url, host, path, query, body, headers; | ||
options = utils.sanitizeOptions(options, getOptions()); | ||
@@ -54,3 +54,3 @@ | ||
snippet = `${request.method} ${path}${query} HTTP/1.1\n`; | ||
snippet += `Host: ${host}\n`; | ||
snippet += `Host: ${host}`; | ||
if (request.body && !request.headers.has('Content-Type')) { | ||
@@ -119,4 +119,5 @@ if (request.body.mode === 'file') { | ||
} | ||
snippet += `${utils.getHeaders(request)}\n`; | ||
snippet += `\n${body}`; | ||
headers = utils.getHeaders(request); | ||
snippet += headers ? `\n${headers}` : ''; | ||
snippet += body ? `\n\n${body}` : ''; | ||
return callback(null, snippet); | ||
@@ -123,0 +124,0 @@ } |
{ | ||
"result": [ | ||
"GET /headers HTTP/1.1\nHost: postman-echo.com\nmy-sample-header: Lorem ipsum dolor sit amet\ntesting: 'singlequotes'\nTEST: \"doublequotes\"\n\n", | ||
"GET /headers HTTP/1.1\nHost: postman-echo.com\nmy-sample-header: Lorem ipsum dolor sit amet\nTEST: @#$%^&*()\nmore: ,./';[]}{\":?><|\\\\\n\n", | ||
"GET /headers HTTP/1.1\nHost: postman-echo.com\nmy-sample-header: Lorem ipsum dolor sit amet\nnot-disabled-header: ENABLED\n\n", | ||
"GET /get?test=123&anotherone=232 HTTP/1.1\nHost: postman-echo.com\n\n\n", | ||
"GET /headers HTTP/1.1\nHost: postman-echo.com\nmy-sample-header: Lorem ipsum dolor sit amet\ntesting: 'singlequotes'\nTEST: \"doublequotes\"", | ||
"GET /headers HTTP/1.1\nHost: postman-echo.com\nmy-sample-header: Lorem ipsum dolor sit amet\nTEST: @#$%^&*()\nmore: ,./';[]}{\":?><|\\\\", | ||
"GET /headers HTTP/1.1\nHost: postman-echo.com\nmy-sample-header: Lorem ipsum dolor sit amet\nnot-disabled-header: ENABLED", | ||
"GET /get?test=123&anotherone=232 HTTP/1.1\nHost: postman-echo.com", | ||
"POST /post HTTP/1.1\nHost: postman-echo.com\nContent-Length: 586\nContent-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW\n\n----WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"pl\"\n\n'a'\n----WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"qu\"\n\n\"b\"\n----WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"hdjkljh\"\n\nc\n----WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"sa\"\n\nd\n----WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"Special\"\n\n!@#$%&*()^_+=`~ \n----WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"more\"\n\n,./';[]}{\":?><|\\\\\n----WebKitFormBoundary7MA4YWxkTrZu0gW\n", | ||
"POST /post?a=!@$^*()_-`%26&b=,./';[]}{\":/?><|| HTTP/1.1\nHost: postman-echo.com\n\n\n", | ||
"POST /post?a=!@$^*()_-`%26&b=,./';[]}{\":/?><|| HTTP/1.1\nHost: postman-echo.com", | ||
"POST /post HTTP/1.1\nHost: postman-echo.com\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 284\n\nDuis posuere augue vel cursus pharetra. In luctus a ex nec pretium. Praesent neque quam, tincidunt nec leo eget, rutrum vehicula magna.\nMaecenas consequat elementum elit, id semper sem tristique et. Integer pulvinar enim quis consectetur interdum volutpat.!@#$%^&*()+POL:},'';,[;[;\n\n\n", | ||
@@ -15,3 +15,3 @@ "POST /post HTTP/1.1\nHost: postman-echo.com\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 81\n\n1='a'&2=\"b\"&'3'=c&\"4\"=d&Special=!@%23$%%26*()^_=`~ &more=,./';[]}{\":?><|\\\\ ", | ||
"POST /post HTTP/1.1\nHost: postman-echo.com\nContent-Type: text/html\nContent-Length: 52\n\n<html>\n Test Test !@#$%^&*()+POL:},'';,[;[;\n</html>", | ||
"POST /post?a=''&b=\"\" HTTP/1.1\nHost: postman-echo.com\n\n\n", | ||
"POST /post?a=''&b=\"\" HTTP/1.1\nHost: postman-echo.com", | ||
"PUT /put HTTP/1.1\nHost: postman-echo.com\nContent-Type: text/plain\nContent-Length: 256\n\nEtiam mi lacus, cursus vitae felis et, blandit pellentesque neque. Vestibulum eget nisi a tortor commodo dignissim.\nQuisque ipsum ligula, faucibus a felis a, commodo elementum nisl. Mauris vulputate sapien et tincidunt viverra. Donec vitae velit nec metus.", | ||
@@ -24,11 +24,11 @@ "PATCH /patch HTTP/1.1\nHost: postman-echo.com\nContent-Type: text/plain\nContent-Length: 256\n\nCurabitur auctor, elit nec pulvinar porttitor, ex augue condimentum enim, eget suscipit urna felis quis neque.\nSuspendisse sit amet luctus massa, nec venenatis mi. Suspendisse tincidunt massa at nibh efficitur fringilla. Nam quis congue mi. Etiam volutpat.", | ||
"LOCK /request HTTP/1.1\nHost: mockbin.org\nContent-Type: text/plain\nContent-Length: 256\n\nDuis posuere augue vel cursus pharetra. In luctus a ex nec pretium. Praesent neque quam, tincidunt nec leo eget, rutrum vehicula magna.\nMaecenas consequat elementum elit, id semper sem tristique et. Integer pulvinar enim quis consectetur interdum volutpat.", | ||
"UNLOCK /request HTTP/1.1\nHost: mockbin.org\n\n\n", | ||
"UNLOCK /request HTTP/1.1\nHost: mockbin.org", | ||
"PROPFIND /request HTTP/1.1\nHost: mockbin.org\nContent-Type: text/plain\nContent-Length: 256\n\nDuis posuere augue vel cursus pharetra. In luctus a ex nec pretium. Praesent neque quam, tincidunt nec leo eget, rutrum vehicula magna.\nMaecenas consequat elementum elit, id semper sem tristique et. Integer pulvinar enim quis consectetur interdum volutpat.", | ||
"VIEW /request HTTP/1.1\nHost: mockbin.org\nContent-Type: text/plain\nContent-Length: 256\n\nDuis posuere augue vel cursus pharetra. In luctus a ex nec pretium. Praesent neque quam, tincidunt nec leo eget, rutrum vehicula magna.\nMaecenas consequat elementum elit, id semper sem tristique et. Integer pulvinar enim quis consectetur interdum volutpat.", | ||
"PURGE / HTTP/1.1\nHost: 9c76407d-5b8d-4b22-99fb-8c47a85d9848.mock.pstmn.io\n\n\n", | ||
"COPY / HTTP/1.1\nHost: 9c76407d-5b8d-4b22-99fb-8c47a85d9848.mock.pstmn.io\n\n\n", | ||
"PURGE / HTTP/1.1\nHost: 9c76407d-5b8d-4b22-99fb-8c47a85d9848.mock.pstmn.io", | ||
"COPY / HTTP/1.1\nHost: 9c76407d-5b8d-4b22-99fb-8c47a85d9848.mock.pstmn.io", | ||
"POST /post HTTP/1.1\nHost: postman-echo.com\nContent-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Length: 174\n\n----WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"file\"; filename=\"file.txt\"\nContent-Type: text/plain\n\n(data)\n----WebKitFormBoundary7MA4YWxkTrZu0gW\n", | ||
"POST /post HTTP/1.1\nHost: postman-echo.com\nContent-Type: text/plain\nContent-Length: 22\n\n\"<file contents here>\"", | ||
"GET / HTTP/1.1\nHost: localhost:5050\n\n\n", | ||
"GET /knockknock HTTP/1.1\nHost: localhost:5050\n\n\n" | ||
"GET / HTTP/1.1\nHost: localhost:5050", | ||
"GET /knockknock HTTP/1.1\nHost: localhost:5050" | ||
], | ||
@@ -35,0 +35,0 @@ "trimmedResult": [ |
@@ -280,2 +280,21 @@ let testCollection = require('../resources/test-collection.json'), | ||
}); | ||
it('should not add extra newlines if there is no body or header present', function () { | ||
var request = new Request({ | ||
'method': 'GET', | ||
'url': { | ||
'host': [ | ||
'example', | ||
'com' | ||
] | ||
} | ||
}); | ||
convert(request, {}, function (error, snippet) { | ||
if (error) { | ||
expect.fail(null, null, error); | ||
} | ||
expect(snippet).to.equal('GET / HTTP/1.1\nHost: example.com'); | ||
}); | ||
}); | ||
}); | ||
@@ -282,0 +301,0 @@ |
@@ -28,3 +28,3 @@ var shell = require('shelljs'), | ||
var prepackagePath = path.resolve(__dirname, 'pre-package.js'), | ||
commandOutput = shell.exec('node ' + prepackagePath); | ||
commandOutput = shell.exec(`node "${prepackagePath}"`); | ||
@@ -31,0 +31,0 @@ if (commandOutput.code !== 0) { |
{ | ||
"name": "postman-code-generators", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Generates code snippets for a postman collection", | ||
@@ -34,6 +34,6 @@ "main": "index.js", | ||
"devDependencies": { | ||
"browserify": "14.4.0", | ||
"chai": "4.1.2", | ||
"browserify": "14.5.0", | ||
"chai": "4.2.0", | ||
"chalk": "2.4.2", | ||
"eslint": "5.0.0", | ||
"eslint": "5.16.0", | ||
"dependency-check": "2.10.1", | ||
@@ -43,6 +43,6 @@ "editorconfig": "0.15.3", | ||
"eslint-plugin-lodash": "2.7.0", | ||
"eslint-plugin-mocha": "4.11.0", | ||
"eslint-plugin-mocha": "4.12.1", | ||
"eslint-plugin-security": "1.4.0", | ||
"istanbul": "0.4.5", | ||
"js-yaml": "3.13.1", | ||
"js-yaml": "3.14.0", | ||
"newman": "5.2.0", | ||
@@ -54,3 +54,3 @@ "jsdoc": "3.6.6", | ||
"parse-gitignore": "1.0.1", | ||
"pretty-ms": "3.0.1", | ||
"pretty-ms": "3.2.0", | ||
"recursive-readdir": "2.2.2", | ||
@@ -57,0 +57,0 @@ "watchify": "3.11.1" |
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
1359332
35703