httpsnippet
Advanced tools
Comparing version 1.0.0-beta.3 to 1.0.0-beta.4
{ | ||
"version": "1.0.0-beta.3", | ||
"version": "1.0.0-beta.4", | ||
"name": "httpsnippet", | ||
@@ -4,0 +4,0 @@ "description": "HTTP Request snippet generator for *most* languages", |
@@ -38,6 +38,13 @@ 'use strict'; | ||
// request body | ||
if (this.source.postData) { | ||
code.push(util.format('%s %s', opts.short ? '-d' : '--data', JSON.stringify(this.source.postData.text))); | ||
if (this.source.postData && this.source.postData.text) { | ||
code.push(util.format('%s %s', opts.short ? '-F' : '--form', JSON.stringify(this.source.postData.text))); | ||
} | ||
// construct post params | ||
if (this.source.postData && !this.source.postData.text && this.source.postData.params && this.source.postData.params.length) { | ||
this.source.postData.params.map(function (param) { | ||
code.push(util.format('%s "%s=%s"', opts.short ? '-d' : '--data', param.name, param.value)); | ||
}); | ||
} | ||
return code.join(opts.indent !== false ? ' \\\n' + opts.indent : ' '); | ||
@@ -44,0 +51,0 @@ }; |
@@ -24,3 +24,3 @@ 'use strict'; | ||
// start with body pipe | ||
if (this.source.postData) { | ||
if (this.source.postData && this.source.postData.text) { | ||
code.push(util.format('echo %s | ', JSON.stringify(this.source.postData.text))); | ||
@@ -90,2 +90,9 @@ } | ||
// construct post params | ||
if (this.source.postData && !this.source.postData.text && this.source.postData.params && this.source.postData.params.length) { | ||
this.source.postData.params.map(function (param) { | ||
code.push(util.format('%s:%s', param.name, param.value)); | ||
}); | ||
} | ||
// construct headers | ||
@@ -92,0 +99,0 @@ if (this.source.headers && this.source.headers.length) { |
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
36110
558