Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding x-www-form-urlencoded #3499

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions server/model/monitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,9 @@ class Monitor extends BeanModel {
} catch (e) {
throw new Error("Your JSON body is invalid. " + e.message);
}
} else if (this.httpBodyEncoding === "form") {
bodyValue = this.body;
contentType = "application/x-www-form-urlencoded; charset=utf-8";
anderskvist marked this conversation as resolved.
Show resolved Hide resolved
} else if (this.httpBodyEncoding === "xml") {
bodyValue = this.body;
contentType = "text/xml; charset=utf-8";
Expand Down
5 changes: 5 additions & 0 deletions src/pages/EditMonitor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,7 @@
<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>
Expand Down Expand Up @@ -929,6 +930,10 @@ message HealthCheckResponse {
<Uptime>Kuma</Uptime>
</soap:Body>
</soap:Envelope>` ]);
}
if (this.monitor && this.monitor.httpBodyEncoding && this.monitor.httpBodyEncoding === "form") {
louislam marked this conversation as resolved.
Show resolved Hide resolved
return this.$t("Example:", [ `
key1=value1&key2=value2` ]);
}
return this.$t("Example:", [ `
{
Expand Down