Skip to content

Commit ceddcd5

Browse files
committed
Do not create new URL object from url.toString()
1 parent 87b3b50 commit ceddcd5

File tree

18 files changed

+43
-2177
lines changed

18 files changed

+43
-2177
lines changed

codegens/golang/lib/index.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
var _ = require('./lodash'),
2-
sdk = require('postman-collection'),
32
sanitize = require('./util').sanitize,
43
sanitizeMultiline = require('./util').sanitizeMultiline,
54
sanitizeOptions = require('./util').sanitizeOptions,
@@ -175,7 +174,7 @@ self = module.exports = {
175174
}
176175
options = sanitizeOptions(options, self.getOptions());
177176

178-
var codeSnippet, indent, trim, timeout, followRedirect, finalUrl,
177+
var codeSnippet, indent, trim, timeout, followRedirect,
179178
bodySnippet = '',
180179
responseSnippet = '',
181180
headerSnippet = '';
@@ -244,10 +243,7 @@ self = module.exports = {
244243
}
245244
codeSnippet += `${indent}"net/http"\n${indent}"io/ioutil"\n)\n\n`;
246245

247-
finalUrl = new sdk.Url(request.url.toString());
248-
finalUrl = finalUrl.toString();
249-
250-
codeSnippet += `func main() {\n\n${indent}url := "${finalUrl}"\n`;
246+
codeSnippet += `func main() {\n\n${indent}url := "${sanitize(request.url.toString())}"\n`;
251247
codeSnippet += `${indent}method := "${request.method}"\n\n`;
252248

253249
if (bodySnippet !== '') {

codegens/golang/npm-shrinkwrap.json

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

codegens/golang/package.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@
2626
"author": "Postman Labs <[email protected]>",
2727
"license": "Apache-2.0",
2828
"homepage": "https://github.com/postmanlabs/code-generators/tree/master/codegens/golang",
29-
"dependencies": {
30-
"postman-collection": "3.6.8"
31-
},
29+
"dependencies": {},
3230
"devDependencies": {},
3331
"engines": {
3432
"node": ">=8"

0 commit comments

Comments
 (0)