Skip to content

Commit

Permalink
Do not create new URL object from url.toString()
Browse files Browse the repository at this point in the history
  • Loading branch information
webholik committed Jan 9, 2021
1 parent 87b3b50 commit 155e595
Show file tree
Hide file tree
Showing 19 changed files with 35 additions and 2,220 deletions.
8 changes: 2 additions & 6 deletions codegens/golang/lib/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
var _ = require('./lodash'),
sdk = require('postman-collection'),
sanitize = require('./util').sanitize,
sanitizeMultiline = require('./util').sanitizeMultiline,
sanitizeOptions = require('./util').sanitizeOptions,
Expand Down Expand Up @@ -175,7 +174,7 @@ self = module.exports = {
}
options = sanitizeOptions(options, self.getOptions());

var codeSnippet, indent, trim, timeout, followRedirect, finalUrl,
var codeSnippet, indent, trim, timeout, followRedirect,
bodySnippet = '',
responseSnippet = '',
headerSnippet = '';
Expand Down Expand Up @@ -244,10 +243,7 @@ self = module.exports = {
}
codeSnippet += `${indent}"net/http"\n${indent}"io/ioutil"\n)\n\n`;

finalUrl = new sdk.Url(request.url.toString());
finalUrl = finalUrl.toString();

codeSnippet += `func main() {\n\n${indent}url := "${finalUrl}"\n`;
codeSnippet += `func main() {\n\n${indent}url := "${sanitize(request.url.toString())}"\n`;
codeSnippet += `${indent}method := "${request.method}"\n\n`;

if (bodySnippet !== '') {
Expand Down
357 changes: 1 addition & 356 deletions codegens/golang/npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions codegens/golang/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
"author": "Postman Labs <help@getpostman.com>",
"license": "Apache-2.0",
"homepage": "https://github.com/postmanlabs/code-generators/tree/master/codegens/golang",
"dependencies": {
"postman-collection": "3.6.8"
},
"dependencies": {},
"devDependencies": {},
"engines": {
"node": ">=8"
Expand Down

0 comments on commit 155e595

Please sign in to comment.