forked from extern/bruno
571 - allow and encode multiline uri form data
This commit is contained in:
parent
f8f38802a9
commit
ddddab8112
@ -107,6 +107,7 @@ const FormUrlEncodedParams = ({ item, collection }) => {
|
||||
'value'
|
||||
)
|
||||
}
|
||||
allowNewlines={true}
|
||||
onRun={handleRun}
|
||||
collection={collection}
|
||||
/>
|
||||
|
@ -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();
|
||||
}
|
||||
},
|
||||
|
@ -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 {
|
||||
|
@ -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')
|
||||
)}`;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user