1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.BufferedHTMLResponse = exports.HTMLResponse = void 0;
|
4 | const stream_response_1 = require("@worker-tools/stream-response");
|
5 | const CONTENT_TYPE = 'Content-Type';
|
6 |
|
7 |
|
8 |
|
9 | class HTMLResponse extends stream_response_1.StreamResponse {
|
10 | constructor(html, { headers: _headers, ...init } = {}) {
|
11 | const headers = new Headers(_headers);
|
12 | if (!headers.has(CONTENT_TYPE))
|
13 | headers.set(CONTENT_TYPE, HTMLResponse.contentType);
|
14 | super(html, { headers, ...init });
|
15 | }
|
16 | }
|
17 | exports.HTMLResponse = HTMLResponse;
|
18 | Object.defineProperty(HTMLResponse, "contentType", {
|
19 | enumerable: true,
|
20 | configurable: true,
|
21 | writable: true,
|
22 | value: 'text/html;charset=UTF-8'
|
23 | });
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 | class BufferedHTMLResponse extends stream_response_1.BufferedStreamResponse {
|
30 | constructor(html, { headers: _headers, ...init } = {}) {
|
31 | const headers = new Headers(_headers);
|
32 | if (!headers.has(CONTENT_TYPE))
|
33 | headers.set(CONTENT_TYPE, BufferedHTMLResponse.contentType);
|
34 | super(html, { headers, ...init });
|
35 | }
|
36 | }
|
37 | exports.BufferedHTMLResponse = BufferedHTMLResponse;
|
38 | Object.defineProperty(BufferedHTMLResponse, "contentType", {
|
39 | enumerable: true,
|
40 | configurable: true,
|
41 | writable: true,
|
42 | value: 'text/html;charset=UTF-8'
|
43 | });
|
44 |
|
\ | No newline at end of file |