Skip to content

Commit abfd151

Browse files
author
Ankit Saini
authored
Merge pull request #690 from postmanlabs/release/1.6.1
Release 1.6.1
2 parents c45ef3c + 160d7a7 commit abfd151

File tree

8 files changed

+50
-42
lines changed

8 files changed

+50
-42
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
v1.6.1 (March 27, 2023)
2+
* Fix backlashes being unescaped unnecessarily in cURL codegen
3+
14
v1.6.0 (March 17, 2023)
25
* PEP8 improvements in python-requests code
36
* Fix for - [#491](https://github.com/postmanlabs/postman-code-generators/issues/491) Added support for kotlin okhttp code snippets.

codegens/curl/lib/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ self = module.exports = {
141141
isAsperandPresent = _.includes(rawBody, '@'),
142142
// Use the long option if `@` is present in the request body otherwise follow user setting
143143
optionName = isAsperandPresent ? '--data-raw' : form('-d', format);
144-
snippet += indent + `${optionName} ${quoteType}${sanitize(rawBody, trim, quoteType, true)}${quoteType}`;
144+
// eslint-disable-next-line max-len
145+
snippet += indent + `${optionName} ${quoteType}${sanitize(rawBody, trim, quoteType)}${quoteType}`;
145146
break;
146147
}
147148

codegens/curl/test/unit/convert.test.js

-35
Original file line numberDiff line numberDiff line change
@@ -34,41 +34,6 @@ describe('curl convert function', function () {
3434
});
3535
});
3636

37-
it('should escape backslash in raw bodies', function () {
38-
request = new sdk.Request({
39-
'method': 'POST',
40-
'header': [
41-
{
42-
'key': 'Content-Type',
43-
'value': 'application/json'
44-
}
45-
],
46-
'body': {
47-
'mode': 'raw',
48-
'raw': '{ "foo": "\\" }'
49-
},
50-
'url': {
51-
'raw': 'https://postman-echo.com/post',
52-
'protocol': 'https',
53-
'host': [
54-
'postman-echo',
55-
'com'
56-
],
57-
'path': [
58-
'post'
59-
]
60-
}
61-
});
62-
63-
convert(request, {}, function (error, snippet) {
64-
if (error) {
65-
expect.fail(null, null, error);
66-
}
67-
68-
expect(snippet).to.contain('{ "foo": "\\\\" }');
69-
});
70-
});
71-
7237
it('should return snippet with url in single quote(\')', function () {
7338
request = new sdk.Request({
7439
'method': 'POST',

codegens/r-httr/test/newman/newman.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe('r-httr Converter', function () {
1313
fileName: 'snippet.r',
1414
// Run script required to run the generated code snippet
1515
runScript: 'Rscript snippet.r',
16-
skipCollections: ['redirectCollection', 'unsupportedMethods']
16+
skipCollections: ['redirectCollection', 'unsupportedMethods', 'rawBody']
1717
};
1818
runNewmanTest(convert, options, testConfig);
1919
});

npm/ci-requirements.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ pushd ./codegens/swift &>/dev/null;
6666
sudo apt-get update
6767
sudo apt-get install clang-3.6 libicu-dev libpython2.7 -y
6868
sudo apt-get install libcurl4 libpython2.7-dev -y
69-
sudo wget https://download.swift.org/swift-5.7.3-release/ubuntu2004/swift-5.7.3-RELEASE/swift-5.7.3-RELEASE-ubuntu20.04.tar.gz
69+
sudo wget -q https://download.swift.org/swift-5.7.3-release/ubuntu2004/swift-5.7.3-RELEASE/swift-5.7.3-RELEASE-ubuntu20.04.tar.gz
7070
sudo tar xzf swift-5.7.3-RELEASE-ubuntu20.04.tar.gz
7171
sudo chmod 777 swift-5.7.3-RELEASE-ubuntu20.04/usr/lib/swift/CoreFoundation/module.map
7272
popd &>/dev/null;
@@ -82,7 +82,7 @@ sudo apt-get install httpie
8282

8383
echo "Installing dependencies required for tests in codegens/dart"
8484
pushd ./codegens/dart-http &>/dev/null;
85-
wget https://storage.googleapis.com/dart-archive/channels/stable/release/2.10.2/linux_packages/dart_2.10.2-1_amd64.deb
85+
wget -q https://storage.googleapis.com/dart-archive/channels/stable/release/2.10.2/linux_packages/dart_2.10.2-1_amd64.deb
8686
sudo dpkg -i dart_2.10.2-1_amd64.deb
8787
echo '''name: test
8888
dependencies:
@@ -100,7 +100,7 @@ echo "Installing dependencies required for tests in codegens/php-guzzle"
100100

101101
echo "Installing dependencies required for tests in codegens/r-rCurl and r-httr Installing R"
102102
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
103-
sudo add-apt-repository 'deb [arch=amd64,i386] https://cran.rstudio.com/bin/linux/ubuntu xenial-cran40/'
103+
sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/'
104104
sudo apt-get update
105105
sudo apt-get install r-base
106106

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.6.0",
3+
"version": "1.6.1",
44
"description": "Generates code snippets for a postman collection",
55
"main": "index.js",
66
"directories": {
+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"info": {
3+
"_postman_id": "f52ee07d-6345-4220-89af-e6696b3c0122",
4+
"name": "Basic Collection",
5+
"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.",
6+
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
7+
},
8+
"item": [
9+
{
10+
"name": "POST raw with quoted text",
11+
"event": [],
12+
"request": {
13+
"method": "POST",
14+
"header": [
15+
{
16+
"key": "Content-Type",
17+
"value": "application/json"
18+
}
19+
],
20+
"body": {
21+
"mode": "raw",
22+
"raw": "{\n \"Hello\": \"{\\\"hello_world\\\": true}\"\n}"
23+
},
24+
"url": {
25+
"raw": "https://postman-echo.com/post",
26+
"protocol": "https",
27+
"host": [
28+
"postman-echo",
29+
"com"
30+
],
31+
"path": [
32+
"post"
33+
]
34+
}
35+
},
36+
"response": []
37+
}
38+
]
39+
}

0 commit comments

Comments
 (0)