MCPcopy
hub / github.com/alibaba/lowcode-engine / doRequest

Function doRequest

packages/renderer-core/src/utils/data-helper.ts:24–44  ·  view source on GitHub ↗
(type: DataSourceType, options: any)

Source from the content-addressed store, hash-verified

22 * @param {any} options
23 */
24export function doRequest(type: DataSourceType, options: any) {
25 // eslint-disable-next-line prefer-const
26 let { uri, url, method = 'GET', headers, params, ...otherProps } = options;
27 otherProps = otherProps || {};
28 if (type === 'jsonp') {
29 return jsonp(uri, params, otherProps);
30 }
31
32 if (type === 'fetch') {
33 switch (method.toUpperCase()) {
34 case 'GET':
35 return get(uri, params, headers, otherProps);
36 case 'POST':
37 return post(uri, params, headers, otherProps);
38 default:
39 return request(uri, method, params, headers, otherProps);
40 }
41 }
42
43 logger.log(`Engine default dataSource does not support type:[${type}] dataSource request!`, options);
44}
45
46// TODO: according to protocol, we should implement errorHandler/shouldFetch/willFetch/requestHandler and isSync controll.
47export class DataHelper {

Callers 2

doFetchMethod · 0.85

Calls 5

jsonpFunction · 0.90
getFunction · 0.90
postFunction · 0.90
requestFunction · 0.90
logMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…