mirror of
https://github.com/movie-web/providers.git
synced 2025-09-13 17:33:26 +00:00
add vidsrc source+embed and StreamBucket embed
This commit is contained in:
@@ -34,6 +34,7 @@ export function makeFullFetcher(fetcher: Fetcher): UseableFetcher {
|
||||
query: ops?.query ?? {},
|
||||
baseUrl: ops?.baseUrl ?? '',
|
||||
body: ops?.body,
|
||||
returnRaw: ops?.returnRaw,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
@@ -17,6 +17,7 @@ export type FetchReply = {
|
||||
text(): Promise<string>;
|
||||
json(): Promise<any>;
|
||||
headers: FetchHeaders;
|
||||
url: string;
|
||||
};
|
||||
|
||||
export type FetchLike = (url: string, ops?: FetchOps | undefined) => Promise<FetchReply>;
|
||||
|
@@ -17,6 +17,10 @@ export function makeStandardFetcher(f: FetchLike): Fetcher {
|
||||
body: seralizedBody.body,
|
||||
});
|
||||
|
||||
if (ops.returnRaw) {
|
||||
return res;
|
||||
}
|
||||
|
||||
const isJson = res.headers.get('content-type')?.includes('application/json');
|
||||
if (isJson) return res.json();
|
||||
return res.text();
|
||||
|
@@ -4,8 +4,9 @@ export type FetcherOptions = {
|
||||
baseUrl?: string;
|
||||
headers?: Record<string, string>;
|
||||
query?: Record<string, string>;
|
||||
method?: 'GET' | 'POST';
|
||||
method?: 'HEAD' | 'GET' | 'POST';
|
||||
body?: Record<string, any> | string | FormData | URLSearchParams;
|
||||
returnRaw?: boolean;
|
||||
};
|
||||
|
||||
export type DefaultedFetcherOptions = {
|
||||
@@ -13,7 +14,8 @@ export type DefaultedFetcherOptions = {
|
||||
body?: Record<string, any> | string | FormData;
|
||||
headers: Record<string, string>;
|
||||
query: Record<string, string>;
|
||||
method: 'GET' | 'POST';
|
||||
method: 'HEAD' | 'GET' | 'POST';
|
||||
returnRaw?: boolean;
|
||||
};
|
||||
|
||||
export type Fetcher<T = any> = {
|
||||
|
Reference in New Issue
Block a user