devstar插件
This commit is contained in:
20
node_modules/search-insights/lib/utils/getRequesterForNode.ts
generated
vendored
Normal file
20
node_modules/search-insights/lib/utils/getRequesterForNode.ts
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
import {
|
||||
supportsNodeHttpModule,
|
||||
supportsNativeFetch
|
||||
} from "./featureDetection";
|
||||
import type { RequestFnType } from "./request";
|
||||
import { requestWithNodeHttpModule, requestWithNativeFetch } from "./request";
|
||||
|
||||
export function getRequesterForNode(): RequestFnType {
|
||||
if (supportsNodeHttpModule()) {
|
||||
return requestWithNodeHttpModule;
|
||||
}
|
||||
|
||||
if (supportsNativeFetch()) {
|
||||
return requestWithNativeFetch;
|
||||
}
|
||||
|
||||
throw new Error(
|
||||
"Could not find a supported HTTP request client in this environment."
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user