mirror of
https://github.com/aljazceru/ditto.git
synced 2026-01-07 07:34:25 +01:00
fetchWorker: support RequestInit
This commit is contained in:
@@ -1,8 +1,14 @@
|
||||
import { Comlink } from '@/deps.ts';
|
||||
|
||||
import './handlers/abortsignal.ts';
|
||||
|
||||
export const FetchWorker = {
|
||||
async fetch(url: string): Promise<[BodyInit, ResponseInit]> {
|
||||
const response = await fetch(url);
|
||||
async fetch(
|
||||
url: string,
|
||||
init: Omit<RequestInit, 'signal'>,
|
||||
signal: AbortSignal | null | undefined,
|
||||
): Promise<[BodyInit, ResponseInit]> {
|
||||
const response = await fetch(url, { ...init, signal });
|
||||
return [
|
||||
await response.text(),
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user