From 3adc9e65d6d5cd461abc461929f29513bc41e21a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Faruk=20Gen=C3=A7?= <omer@farukgenc.com>
Date: Sat, 14 Jan 2023 16:33:21 +0300
Subject: [PATCH] Add only xml support to http monitors

---
 server/model/monitor.js   |  7 ++-----
 src/pages/EditMonitor.vue | 23 ++++++++---------------
 2 files changed, 10 insertions(+), 20 deletions(-)

diff --git a/server/model/monitor.js b/server/model/monitor.js
index 48b0b1d321..d93fd6ddf1 100644
--- a/server/model/monitor.js
+++ b/server/model/monitor.js
@@ -251,16 +251,13 @@ class Monitor extends BeanModel {
 
                     let contentType = null;
                     let bodyValue = null;
-                    
+
                     if (this.body && !this.httpBodyEncoding || this.httpBodyEncoding === "json") {
                         bodyValue = JSON.parse(this.body);
                         contentType = "application/json";
                     } else if (this.body && (this.httpBodyEncoding === "xml")) {
                         bodyValue = this.body;
-                        contentType = "text/xml";
-                    } else if (this.body && (this.httpBodyEncoding === "form")) {
-                        bodyValue = this.body;
-                        contentType = "application/x-www-form-urlencoded";
+                        contentType = "text/xml; charset=utf-8";
                     }
 
                     const options = {
diff --git a/src/pages/EditMonitor.vue b/src/pages/EditMonitor.vue
index ea246c6005..05b89ab0c6 100644
--- a/src/pages/EditMonitor.vue
+++ b/src/pages/EditMonitor.vue
@@ -438,21 +438,14 @@
                                     </select>
                                 </div>
 
-                                <!-- Encoding -->
-                                <div class="my-3">
-                                    <label for="httpBodyEncoding" class="form-label">{{ $t("Body Encoding") }}</label>
-                                    <select id="httpBodyEncoding" v-model="monitor.httpBodyEncoding" class="form-select">
-                                        <option value="json">
-                                            JSON
-                                        </option>
-                                        <option value="form">
-                                            x-www-form-urlencoded
-                                        </option>
-                                        <option value="xml">
-                                            XML
-                                        </option>
-                                    </select>
-                                </div>
+                              <!-- Encoding -->
+                              <div class="my-3">
+                                <label for="httpBodyEncoding" class="form-label">{{ $t("Body Encoding") }}</label>
+                                <select id="httpBodyEncoding" v-model="monitor.httpBodyEncoding" class="form-select">
+                                  <option value="json">JSON</option>
+                                  <option value="xml">XML</option>
+                                </select>
+                              </div>
 
                                 <!-- Body -->
                                 <div class="my-3">