mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-25 01:14:23 +01:00
fix population of data when data-urlencode flag is used with G flag in curl import (#2025)
This commit is contained in:
parent
67df18e6e0
commit
65dbf9c8ba
@ -33,7 +33,7 @@ const parseCurlCommand = (curlCommand) => {
|
|||||||
curlCommand = curlCommand.trim();
|
curlCommand = curlCommand.trim();
|
||||||
|
|
||||||
const parsedArguments = yargs(curlCommand, {
|
const parsedArguments = yargs(curlCommand, {
|
||||||
boolean: ['I', 'head', 'compressed', 'L', 'k', 'silent', 's'],
|
boolean: ['I', 'head', 'compressed', 'L', 'k', 'silent', 's', 'G', 'get'],
|
||||||
alias: {
|
alias: {
|
||||||
H: 'header',
|
H: 'header',
|
||||||
A: 'user-agent'
|
A: 'user-agent'
|
||||||
@ -153,7 +153,10 @@ const parseCurlCommand = (curlCommand) => {
|
|||||||
// NB: the -G flag does not change the http verb. It just moves the data into the url.
|
// NB: the -G flag does not change the http verb. It just moves the data into the url.
|
||||||
if (parsedArguments.G || parsedArguments.get) {
|
if (parsedArguments.G || parsedArguments.get) {
|
||||||
urlObject.query = urlObject.query ? urlObject.query : '';
|
urlObject.query = urlObject.query ? urlObject.query : '';
|
||||||
const option = 'd' in parsedArguments ? 'd' : 'data' in parsedArguments ? 'data' : null;
|
let option = null;
|
||||||
|
if ('d' in parsedArguments) option = 'd';
|
||||||
|
if ('data' in parsedArguments) option = 'data';
|
||||||
|
if ('data-urlencode' in parsedArguments) option = 'data-urlencode';
|
||||||
if (option) {
|
if (option) {
|
||||||
let urlQueryString = '';
|
let urlQueryString = '';
|
||||||
|
|
||||||
@ -219,6 +222,8 @@ const parseCurlCommand = (curlCommand) => {
|
|||||||
} else if (parsedArguments['data-raw']) {
|
} else if (parsedArguments['data-raw']) {
|
||||||
request.data = parsedArguments['data-raw'];
|
request.data = parsedArguments['data-raw'];
|
||||||
request.isDataRaw = true;
|
request.isDataRaw = true;
|
||||||
|
} else if (parsedArguments['data-urlencode']) {
|
||||||
|
request.data = parsedArguments['data-urlencode'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parsedArguments.u) {
|
if (parsedArguments.u) {
|
||||||
|
Loading…
Reference in New Issue
Block a user