mirror of
https://github.com/movie-web/providers.git
synced 2025-09-13 16:53:24 +00:00
fix compile errors for fetch-likes
This commit is contained in:
@@ -278,7 +278,7 @@ async function processOptions(options: CommandLineArguments) {
|
||||
let fetcher;
|
||||
|
||||
if (options.fetcher === 'native') {
|
||||
fetcher = makeStandardFetcher(fetch as any);
|
||||
fetcher = makeStandardFetcher(fetch);
|
||||
} else {
|
||||
fetcher = makeStandardFetcher(nodeFetch);
|
||||
}
|
||||
|
@@ -10,7 +10,7 @@ export type FetchOps = {
|
||||
};
|
||||
|
||||
export type FetchHeaders = {
|
||||
get(key: string): string | undefined;
|
||||
get(key: string): string | null;
|
||||
};
|
||||
|
||||
export type FetchReply = {
|
||||
@@ -19,4 +19,4 @@ export type FetchReply = {
|
||||
headers: FetchHeaders;
|
||||
};
|
||||
|
||||
export type FetchType = (url: string, ops?: FetchOps) => Promise<FetchReply>;
|
||||
export type FetchLike = (url: string, ops?: FetchOps | undefined) => Promise<FetchReply>;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { makeFullUrl } from '@/fetchers/common';
|
||||
import { FetchType } from '@/fetchers/fetch';
|
||||
import { FetchLike } from '@/fetchers/fetch';
|
||||
import { makeStandardFetcher } from '@/fetchers/standardFetch';
|
||||
import { Fetcher } from '@/fetchers/types';
|
||||
|
||||
@@ -9,7 +9,7 @@ const headerMap: Record<string, string> = {
|
||||
origin: 'X-Origin',
|
||||
};
|
||||
|
||||
export function makeSimpleProxyFetcher(proxyUrl: string, f: FetchType): Fetcher {
|
||||
export function makeSimpleProxyFetcher(proxyUrl: string, f: FetchLike): Fetcher {
|
||||
const fetcher = makeStandardFetcher(f);
|
||||
const proxiedFetch: Fetcher = async (url, ops) => {
|
||||
const fullUrl = makeFullUrl(url, ops);
|
||||
|
@@ -1,9 +1,9 @@
|
||||
import { serializeBody } from '@/fetchers/body';
|
||||
import { makeFullUrl } from '@/fetchers/common';
|
||||
import { FetchType } from '@/fetchers/fetch';
|
||||
import { FetchLike } from '@/fetchers/fetch';
|
||||
import { Fetcher } from '@/fetchers/types';
|
||||
|
||||
export function makeStandardFetcher(f: FetchType): Fetcher {
|
||||
export function makeStandardFetcher(f: FetchLike): Fetcher {
|
||||
const normalFetch: Fetcher = async (url, ops) => {
|
||||
const fullUrl = makeFullUrl(url, ops);
|
||||
const seralizedBody = serializeBody(ops.body);
|
||||
|
Reference in New Issue
Block a user