Add format body option
This commit is contained in:
@@ -184,6 +184,8 @@
|
|||||||
"waiting_receive_schema": "(waiting to receive schema)",
|
"waiting_receive_schema": "(waiting to receive schema)",
|
||||||
"gql_prettify_invalid_query": "Couldn't prettify an invalid query, solve query syntax errors and try again",
|
"gql_prettify_invalid_query": "Couldn't prettify an invalid query, solve query syntax errors and try again",
|
||||||
"prettify_query": "Prettify Query",
|
"prettify_query": "Prettify Query",
|
||||||
|
"json_prettify_invalid_body": "Couldn't prettify an invalid body, solve json syntax errors and try again",
|
||||||
|
"prettify_body": "Prettify body",
|
||||||
"cancel": "Cancel",
|
"cancel": "Cancel",
|
||||||
"save": "Save",
|
"save": "Save",
|
||||||
"dismiss": "Dismiss",
|
"dismiss": "Dismiss",
|
||||||
|
|||||||
@@ -262,6 +262,13 @@
|
|||||||
</button>
|
</button>
|
||||||
</label>
|
</label>
|
||||||
<input ref="payload" name="payload" type="file" @change="uploadPayload" />
|
<input ref="payload" name="payload" type="file" @change="uploadPayload" />
|
||||||
|
<button
|
||||||
|
class="icon"
|
||||||
|
@click="prettifyRequestBody()"
|
||||||
|
v-tooltip="$t('prettify_body')"
|
||||||
|
>
|
||||||
|
<i class="material-icons">assistant</i>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
@@ -2332,6 +2339,16 @@ export default {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
prettifyRequestBody() {
|
||||||
|
try {
|
||||||
|
const jsonObj = JSON.parse(this.rawParams)
|
||||||
|
this.rawParams = JSON.stringify(jsonObj, null, 2)
|
||||||
|
} catch (e) {
|
||||||
|
this.$toast.error(`${this.$t("json_prettify_invalid_body")}`, {
|
||||||
|
icon: "error",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
copyRequest() {
|
copyRequest() {
|
||||||
if (navigator.share) {
|
if (navigator.share) {
|
||||||
const time = new Date().toLocaleTimeString()
|
const time = new Date().toLocaleTimeString()
|
||||||
|
|||||||
Reference in New Issue
Block a user