Merge pull request #594 from AndrewBastin/feat/post-raw-type-handle
POST request body editor reacts to the content type
This commit is contained in:
commit
5ec9944f2a
2 changed files with 16 additions and 1 deletions
11
functions/editorutils.js
Normal file
11
functions/editorutils.js
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
const mimeToMode = {
|
||||
"text/plain": "plain_text",
|
||||
"text/html": "html",
|
||||
"application/xml": "xml",
|
||||
"application/hal+json": "json",
|
||||
"application/json": "json"
|
||||
}
|
||||
|
||||
export function getEditorLangForMimeType(mimeType) {
|
||||
return mimeToMode[mimeType] || "plain_text";
|
||||
}
|
||||
|
|
@ -375,7 +375,7 @@
|
|||
<label for="rawBody">{{ $t("raw_request_body") }}</label>
|
||||
<Editor
|
||||
v-model="rawParams"
|
||||
:lang="'json'"
|
||||
:lang="rawInputEditorLang"
|
||||
:options="{
|
||||
maxLines: '16',
|
||||
minLines: '8',
|
||||
|
|
@ -1385,6 +1385,7 @@ import AceEditor from "../components/ace-editor";
|
|||
import { tokenRequest, oauthRedirect } from "../assets/js/oauth";
|
||||
import { sendNetworkRequest } from "../functions/network";
|
||||
import { fb } from "../functions/fb";
|
||||
import { getEditorLangForMimeType } from "~/functions/editorutils";
|
||||
|
||||
const statusCategories = [
|
||||
{
|
||||
|
|
@ -1808,6 +1809,9 @@ export default {
|
|||
this.$store.commit("setState", { value, attribute: "rawInput" });
|
||||
}
|
||||
},
|
||||
rawInputEditorLang() {
|
||||
return getEditorLangForMimeType(this.contentType);
|
||||
},
|
||||
requestType: {
|
||||
get() {
|
||||
return this.$store.state.request.requestType;
|
||||
|
|
|
|||
Loading…
Reference in a new issue