MCPcopy
hub / github.com/baidu/amis / normalizeApi

Function normalizeApi

packages/amis-core/src/utils/api.ts:87–106  ·  view source on GitHub ↗
(
  api: Api,
  defaultMethod: string = 'get'
)

Source from the content-addressed store, hash-verified

85const isIE = !!(document as any).documentMode;
86
87export function normalizeApi(
88 api: Api,
89 defaultMethod: string = 'get'
90): ApiObject {
91 if (typeof api === 'string') {
92 let method = rSchema.test(api) ? RegExp.$1 : '';
93 method && (api = api.replace(method + ':', ''));
94
95 api = {
96 method: (method || defaultMethod) as any,
97 url: api
98 };
99 } else {
100 api = {
101 ...api
102 };
103 }
104 api.url = typeof api.url === 'string' ? api.url.trim() : api.url;
105 return api;
106}
107
108export function buildApi(
109 api: Api,

Callers 15

reloadMethod · 0.90
handleActionMethod · 0.90
fetchOptionsMethod · 0.90
buildColumnsMethod · 0.90
getConfigMethod · 0.90
uploadFileMethod · 0.90
handleApiMethod · 0.90
handleActionMethod · 0.90
runMethod · 0.90
handleActionFunction · 0.90
componentDidMountMethod · 0.90
scaffoldFormMethod · 0.90

Calls 1

replaceMethod · 0.80

Tested by

no test coverage detected