lowcode-engine icon indicating copy to clipboard operation
lowcode-engine copied to clipboard

请问如何手动调用post请求的数据源并传body进去

Open banixing opened this issue 1 year ago • 4 comments

Describe the bug (required) / 详细描述 bug(必填)

A clear and concise description of what the bug is. / 请提供清晰且精确的 bug 描述


To Reproduce (required) / 如何复现 bug?(必填,非常重要)

Steps to reproduce the behavior: / 详细复现步骤:


English version example:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

中文版示例:

  1. 打开 demo
  2. 点击标题;
  3. 在右侧修改标题内容为「修改后的标题」;
  4. 渲染画布标题组件没有更新显示为「修改后的标题」;

Expected behavior (required) / 预期行为(必填,非常重要)

A clear and concise description of what did you expect to happen. / 请清晰和精确的描述你预期的行为


Screenshots (optional) / bug 截图(可选)

Sceenshots for further information. (If applicable.) / 一些有用的截图将会帮助我们更好的明确以及定位问题


Environments (please complete the following information) (required): / 请提供如下信息(必填)

  • AliLowCodeEngine version: [e.g. 1.0.0] / 低代码引擎版本
  • AliLowCodeEngineExt version: [e.g. 1.0.0] / 低代码引擎扩展包版本
  • Browser [e.g. chrome, safari] / 浏览器版本
  • materials / plugins / tools / 其他物料 / 插件 / 工具链版本

(this information can be collected via the manual plugin / 版本信息可通过低代码用户手册插件收集)

Additional context (optional) / 更多额外信息(可选)

Any other context of the problem here. / 可以追加更多的额外信息,帮助定位问题

banixing avatar Feb 28 '23 07:02 banixing

请求头 Content-Type:application/json, 调用:this.dataSourceMap.xxx.load({demo:'a'})

501981732 avatar Mar 01 '23 01:03 501981732

501981732

这样如果用axios请求的话,config中params和data里面的数据是一样的,会把params里面的内容放在url里面

banixing avatar Apr 10 '23 11:04 banixing

源码是这样的, this.dataSourceMap.xxx.load({demo:'a'}) 时, {demo:'a'}会变成options.params,赋值到data中。

但这样就无法做到同时传 post请求的body和url上的queryString。

很奇e怪xin的设计

export function createFetchHandler(config?: Record<string, unknown>) {
  // eslint-disable-next-line space-before-function-paren
  return async function(options: RuntimeOptionsConfig) {
    const requestConfig: RequestOptions = {
      ...options,
      url: options.uri,
      method: options.method as RequestOptions['method'],
      data: options.params as AsObject,
      headers: options.headers as AsObject,
      ...config,
    };
    const response = await request(requestConfig);
    return response;
  };
}

eightHundreds avatar Apr 21 '23 05:04 eightHundreds

同问,后端始终拿不到body数据

dragon0311 avatar Mar 12 '24 05:03 dragon0311