diff --git a/packages/bruno-app/src/components/RequestPane/FormUrlEncodedParams/index.js b/packages/bruno-app/src/components/RequestPane/FormUrlEncodedParams/index.js index 3cf5842e..6d1d5be2 100644 --- a/packages/bruno-app/src/components/RequestPane/FormUrlEncodedParams/index.js +++ b/packages/bruno-app/src/components/RequestPane/FormUrlEncodedParams/index.js @@ -107,6 +107,7 @@ const FormUrlEncodedParams = ({ item, collection }) => { 'value' ) } + allowNewlines={true} onRun={handleRun} collection={collection} /> diff --git a/packages/bruno-app/src/components/SingleLineEditor/index.js b/packages/bruno-app/src/components/SingleLineEditor/index.js index bee59b2d..fb3bff21 100644 --- a/packages/bruno-app/src/components/SingleLineEditor/index.js +++ b/packages/bruno-app/src/components/SingleLineEditor/index.js @@ -57,6 +57,7 @@ class SingleLineEditor extends Component { } componentDidMount() { // Initialize CodeMirror as a single line editor + /** @type {import("codemirror").Editor} */ this.editor = CodeMirror(this.editorRef.current, { lineWrapping: false, lineNumbers: false, @@ -84,7 +85,10 @@ class SingleLineEditor extends Component { } }, 'Alt-Enter': () => { - if (this.props.onRun) { + if (this.props.allowNewlines) { + this.editor.setValue(this.editor.getValue() + '\n'); + this.editor.setCursor({ line: this.editor.lineCount(), ch: 0 }); + } else if (this.props.onRun) { this.props.onRun(); } }, diff --git a/packages/bruno-lang/v2/src/bruToJson.js b/packages/bruno-lang/v2/src/bruToJson.js index 5ce65eba..d8d51d3b 100644 --- a/packages/bruno-lang/v2/src/bruToJson.js +++ b/packages/bruno-lang/v2/src/bruToJson.js @@ -104,7 +104,7 @@ const mapPairListToKeyValPairs = (pairList = [], parseEnabled = true) => { } return _.map(pairList[0], (pair) => { let name = _.keys(pair)[0]; - let value = pair[name]; + let value = decodeURIComponent(pair[name]); if (!parseEnabled) { return { diff --git a/packages/bruno-lang/v2/src/jsonToBru.js b/packages/bruno-lang/v2/src/jsonToBru.js index 757406b7..56b5ec47 100644 --- a/packages/bruno-lang/v2/src/jsonToBru.js +++ b/packages/bruno-lang/v2/src/jsonToBru.js @@ -154,7 +154,7 @@ ${indentString(body.sparql)} if (enabled(body.formUrlEncoded).length) { bru += `\n${indentString( enabled(body.formUrlEncoded) - .map((item) => `${item.name}: ${item.value}`) + .map((item) => `${item.name}: ${encodeURIComponent(item.value)}`) .join('\n') )}`; } @@ -162,7 +162,7 @@ ${indentString(body.sparql)} if (disabled(body.formUrlEncoded).length) { bru += `\n${indentString( disabled(body.formUrlEncoded) - .map((item) => `~${item.name}: ${item.value}`) + .map((item) => `~${item.name}: ${encodeURIComponent(item.value)}`) .join('\n') )}`; }