MCPcopy Create free account
hub / github.com/Easy-Editor/EasyEditor / getRequestHandler

Function getRequestHandler

packages/plugin-datasource/src/helpers/index.ts:26–33  ·  view source on GitHub ↗
(ds, requestHandlersMap)

Source from the content-addressed store, hash-verified

24
25// 从当前 dataSourceItem 中获取 requestHandler
26export const getRequestHandler: GetRequestHandler = (ds, requestHandlersMap) => {
27 if (ds.type === 'custom') {
28 // 自定义类型处理
29 return ds.requestHandler as unknown as RequestHandler<{ data: unknown }> // 理论上这里应该是能强转的,就算为空,应该在 request 请求的时候触发失败
30 }
31 // type 协议默认值 fetch
32 return requestHandlersMap[ds.type || 'fetch']
33}
34
35export const promiseSettled =
36 (Promise.allSettled ? Promise.allSettled.bind(Promise) : null) ||

Calls

no outgoing calls

Tested by

no test coverage detected