This commit is contained in:
lloydzhou
2024-09-30 02:57:51 +08:00
parent 8030e71a5a
commit ef4665cd8b
2 changed files with 13 additions and 5 deletions

View File

@@ -85,7 +85,15 @@ export function fetch(url: string, options?: RequestInit): Promise<any> {
.then((res: StreamResponse) => {
request_id = res.request_id;
const { status, status_text: statusText, headers } = res;
return new Response(ts.readable, { status, statusText, headers });
const response = new Response(ts.readable, {
status,
statusText,
headers,
});
if (status >= 300) {
setTimeout(close, 50);
}
return response;
})
.catch((e) => {
console.error("stream error", e);