|
2 | 2 | import { crossSerializeStream, fromJSON, getCrossReferenceHeader } from "seroval";
|
3 | 3 | // @ts-ignore
|
4 | 4 | import {
|
5 |
| - CustomEventPlugin, |
6 |
| - DOMExceptionPlugin, |
7 |
| - EventPlugin, |
8 |
| - FormDataPlugin, |
9 |
| - HeadersPlugin, |
10 |
| - ReadableStreamPlugin, |
11 |
| - RequestPlugin, |
12 |
| - ResponsePlugin, |
13 |
| - URLPlugin, |
14 |
| - URLSearchParamsPlugin |
| 5 | + CustomEventPlugin, |
| 6 | + DOMExceptionPlugin, |
| 7 | + EventPlugin, |
| 8 | + FormDataPlugin, |
| 9 | + HeadersPlugin, |
| 10 | + ReadableStreamPlugin, |
| 11 | + RequestPlugin, |
| 12 | + ResponsePlugin, |
| 13 | + URLPlugin, |
| 14 | + URLSearchParamsPlugin |
15 | 15 | } from "seroval-plugins/web";
|
16 | 16 | import { sharedConfig } from "solid-js";
|
17 | 17 | import { renderToString } from "solid-js/web";
|
@@ -167,15 +167,18 @@ async function handleServerFunction(h3Event: HTTPEvent) {
|
167 | 167 | }
|
168 | 168 |
|
169 | 169 | // handle responses
|
170 |
| - if (result instanceof Response && instance) { |
171 |
| - // forward headers |
172 |
| - if (result.headers) mergeResponseHeaders(h3Event, result.headers); |
173 |
| - // forward non-redirect statuses |
174 |
| - if (result.status && (result.status < 300 || result.status >= 400)) |
175 |
| - setResponseStatus(h3Event, result.status); |
176 |
| - if ((result as any).customBody) { |
177 |
| - result = await (result as any).customBody(); |
178 |
| - } else if (result.body == undefined) result = null; |
| 170 | + if (result instanceof Response) { |
| 171 | + if (result.headers && result.headers.has("X-Content-Raw")) return result; |
| 172 | + if (instance) { |
| 173 | + // forward headers |
| 174 | + if (result.headers) mergeResponseHeaders(h3Event, result.headers); |
| 175 | + // forward non-redirect statuses |
| 176 | + if (result.status && (result.status < 300 || result.status >= 400)) |
| 177 | + setResponseStatus(h3Event, result.status); |
| 178 | + if ((result as any).customBody) { |
| 179 | + result = await (result as any).customBody(); |
| 180 | + } else if (result.body == undefined) result = null; |
| 181 | + } |
179 | 182 | }
|
180 | 183 |
|
181 | 184 | // handle no JS success case
|
|
0 commit comments