Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
fix(req-body): fix preseting default body (raw) by content type
Leonardo Matos8469d13a12a7
diff --git a/pages/index.vue b/pages/index.vueindex 2af4958e2..e2f823396 100644--- a/pages/index.vue+++ b/pages/index.vue@@ -1435,12 +1435,25 @@ export default {canListParameters(canToggleRaw) {this.rawInput = !canToggleRaw},- rawInput(status) {- if (status && this.rawParams === "") {- this.rawParams = "{}"- } else {- this.setRouteQueryState()+ contentType(contentType) {+ switch (contentType) {+ case "application/json":+ case "application/hal+json":+ if (!(this.rawParams.charAt(0) in ['"', "{", "["])) {+ this.rawParams = "{}"+ }+ break+ case "application/xml":+ if (this.rawParams.charAt(0) !== "<" || this.rawParams === "<!doctype html>") {+ this.rawParams = "<?xml version='1.0' encoding='utf-8'?>"+ }+ break+ case "text/html":+ if (this.rawParams.charAt(0) !== "<" || this.rawParams.startsWith("<?xml")) {+ this.rawParams = "<!doctype html>"+ }}+ this.setRouteQueryState()},"response.body": function(val) {if (