fix: encoding parameters twice effecting codegen - fixed #1437

This commit is contained in:
Liyas Thomas
2021-01-24 07:42:07 +05:30
parent ca66b47014
commit f58c6807d0
3 changed files with 6 additions and 6 deletions

View File

@@ -40,7 +40,7 @@
<input <input
:placeholder="$t('value_count', { count: index + 1 })" :placeholder="$t('value_count', { count: index + 1 })"
:name="'value' + index" :name="'value' + index"
:value="decodeURI(encodeURI(param.value))" :value="param.value"
@change=" @change="
$store.commit('setValueParams', { $store.commit('setValueParams', {
index, index,

View File

@@ -483,7 +483,7 @@
<ul> <ul>
<li> <li>
<div class="row-wrapper"> <div class="row-wrapper">
<label for="generatedCode">{{ $t("javascript_code") }}</label> <label>{{ $t("javascript_code") }}</label>
<div> <div>
<a <a
href="https://github.com/hoppscotch/hoppscotch/wiki/Pre-Request-Scripts" href="https://github.com/hoppscotch/hoppscotch/wiki/Pre-Request-Scripts"
@@ -525,7 +525,7 @@
<ul> <ul>
<li> <li>
<div class="row-wrapper"> <div class="row-wrapper">
<label for="generatedCode">{{ $t("javascript_code") }}</label> <label>{{ $t("javascript_code") }}</label>
<div> <div>
<a <a
href="https://github.com/hoppscotch/hoppscotch/wiki/Post-Request-Tests" href="https://github.com/hoppscotch/hoppscotch/wiki/Post-Request-Tests"
@@ -1214,13 +1214,13 @@ export default {
return bodyParams return bodyParams
.filter((item) => (item.hasOwnProperty("active") ? item.active == true : true)) .filter((item) => (item.hasOwnProperty("active") ? item.active == true : true))
.filter(({ key }) => !!key) .filter(({ key }) => !!key)
.map(({ key, value }) => `${key}=${encodeURIComponent(value)}`) .map(({ key, value }) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
.join("&") .join("&")
} }
}, },
queryString() { queryString() {
const result = getQueryParams(this.params) const result = getQueryParams(this.params)
.map(({ key, value }) => `${key}=${encodeURIComponent(value)}`) .map(({ key, value }) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
.join("&") .join("&")
return result === "" ? "" : `?${result}` return result === "" ? "" : `?${result}`
}, },

View File

@@ -76,7 +76,7 @@ export default {
}, },
setValueParams({ request }, { index, value }) { setValueParams({ request }, { index, value }) {
request.params[index].value = encodeURI(value) request.params[index].value = value
}, },
setTypeParams({ request }, { index, value }) { setTypeParams({ request }, { index, value }) {