@scalar/api-client
Version:
the open source API testing client
53 lines (52 loc) • 1.86 kB
JavaScript
import { defineComponent as i, computed as r, createBlock as d, openBlock as m, unref as n, createSlots as c, withCtx as a, createElementVNode as f, createVNode as s, createTextVNode as p } from "vue";
import { ScalarVirtualText as u } from "@scalar/components";
import { formatJsonOrYamlString as x } from "@scalar/oas-utils/helpers";
import { processResponseBody as h } from "../helpers/process-response-body.js";
import y from "./ResponseBodyDownload.vue.js";
import v from "../../../components/layout/CollapsibleSection.vue.js";
const S = /* @__PURE__ */ i({
__name: "ResponseBodyVirtual",
props: {
content: {},
data: {},
headers: {}
},
setup(o) {
const l = r(() => x(o.content)), e = r(
() => h({
data: o.data,
headers: o.headers
})
);
return (b, t) => (m(), d(n(v), { class: "!max-h-100% response-body-virtual overflow-x-auto" }, c({
title: a(() => [
t[0] || (t[0] = p("Body", -1))
]),
default: a(() => [
t[1] || (t[1] = f("div", { class: "font-code text-xxs rounded-t border border-b-0 px-2.5 py-1.5" }, " This response body is massive! Syntax highlighting won't work here. ", -1)),
s(n(u), {
containerClass: "custom-scroll scalar-code-block border rounded-b flex flex-1 max-h-screen",
contentClass: "language-plaintext whitespace-pre font-code text-base",
lineHeight: 20,
text: l.value
}, null, 8, ["text"])
]),
_: 2
}, [
e.value.dataUrl ? {
name: "actions",
fn: a(() => [
s(y, {
filename: e.value.attachmentFilename,
href: e.value.dataUrl,
type: e.value.mimeType?.essence
}, null, 8, ["filename", "href", "type"])
]),
key: "0"
} : void 0
]), 1024));
}
});
export {
S as default
};