diff --git a/lang/en-US.json b/lang/en-US.json index fa4719a67..70ab9151f 100644 --- a/lang/en-US.json +++ b/lang/en-US.json @@ -184,6 +184,8 @@ "waiting_receive_schema": "(waiting to receive schema)", "gql_prettify_invalid_query": "Couldn't prettify an invalid query, solve query syntax errors and try again", "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", "save": "Save", "dismiss": "Dismiss", diff --git a/pages/index.vue b/pages/index.vue index e07093356..6bc86c36a 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -262,6 +262,13 @@ + @@ -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() { if (navigator.share) { const time = new Date().toLocaleTimeString()