Merge pull request #683 from SoulKa/fix/571-url-encoded-with-colon

fix #571 - allow newlines and encode uri form data
This commit is contained in:
Anoop M D 2023-10-23 00:25:17 +05:30 committed by GitHub
commit 861604075a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 4 deletions

View File

@ -107,6 +107,7 @@ const FormUrlEncodedParams = ({ item, collection }) => {
'value'
)
}
allowNewlines={true}
onRun={handleRun}
collection={collection}
/>

View File

@ -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();
}
},

View File

@ -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 {

View File

@ -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')
)}`;
}