mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-29 01:51:52 +08:00
Fix types
This commit is contained in:
@@ -11,7 +11,7 @@ import { stringHash } from './string-hash';
|
||||
import { defaultRequestInit, fetchWithLog } from './fetch-retry';
|
||||
import { Custom304NotModifiedError, CustomAbortError, CustomNoETagFallbackError, fetchAssets, sleepWithAbort } from './fetch-assets';
|
||||
|
||||
import type { Response, RequestInit } from 'undici';
|
||||
import type { Response, RequestInit, HeadersInit } from 'undici';
|
||||
|
||||
const enum CacheStatus {
|
||||
Hit = 'hit',
|
||||
@@ -329,9 +329,9 @@ export class Cache<S = string> {
|
||||
signal: controller.signal,
|
||||
...defaultRequestInit,
|
||||
headers: (typeof etag === 'string' && etag.length > 0)
|
||||
? mergeHeaders(
|
||||
defaultRequestInit.headers,
|
||||
{ 'If-None-Match': etag }
|
||||
? mergeHeaders<HeadersInit>(
|
||||
{ 'If-None-Match': etag },
|
||||
defaultRequestInit.headers
|
||||
)
|
||||
: defaultRequestInit.headers
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ export class ResponseError extends Error {
|
||||
}
|
||||
}
|
||||
|
||||
export const defaultRequestInit: RequestInit = {
|
||||
export const defaultRequestInit = {
|
||||
headers: {
|
||||
'User-Agent': 'curl/8.9.1 (https://github.com/SukkaW/Surge)'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user