@scalar/api-client
Version:
the open source API testing client
51 lines (50 loc) • 1.85 kB
JavaScript
import { defineComponent as c, computed as p, toRef as a, createBlock as f, openBlock as x, createSlots as u, withCtx as r, createElementVNode as h, createVNode as s, unref as e, createTextVNode as y } from "vue";
import { ScalarVirtualText as b } from "@scalar/components";
import { formatJsonOrYamlString as g } from "@scalar/oas-utils/helpers";
import _ from "../../../components/ViewLayout/ViewLayoutCollapse.vue.js";
import { useResponseBody as v } from "../../../hooks/useResponseBody.js";
import k from "./ResponseBodyDownload.vue.js";
const R = /* @__PURE__ */ c({
__name: "ResponseBodyVirtual",
props: {
content: {},
data: {},
headers: {}
},
setup(l) {
const o = l, i = p(() => g(o.content)), { mimeType: m, attachmentFilename: d, dataUrl: n } = v({
data: a(o, "data"),
headers: a(o, "headers")
});
return (w, t) => (x(), f(_, { class: "!max-h-100% response-body-virtual overflow-x-auto" }, u({
title: r(() => [
t[0] || (t[0] = y("Body", -1))
]),
default: r(() => [
t[1] || (t[1] = h("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(e(b), {
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: i.value
}, null, 8, ["text"])
]),
_: 2
}, [
e(n) ? {
name: "actions",
fn: r(() => [
s(k, {
filename: e(d),
href: e(n),
type: e(m).essence
}, null, 8, ["filename", "href", "type"])
]),
key: "0"
} : void 0
]), 1024));
}
});
export {
R as default
};