从对 python 的反应中获取 json 主体常量中的变量不起作用

Fetch with variables in constant of json body from react to python is not working

我想弄清楚为什么在双引号有效时传递值,但在使用变量、属性 或参数时却无效。

return 是未定义的对象。

来自 POSTMAN 的一切正常。

这是我在 React js 中的提取(最新版本):

  var currentdate = new Date(); 
  const datetime = currentdate.getDate() + ""
        + (currentdate.getMonth()+1)  + ""
        + currentdate.getFullYear() + ""
        + currentdate.getHours() + ""
        + (currentdate.getMinutes()-1)      
  const body = {
    ...
    numerator: datetime,
    ...
  };
  fetch(`${this.props.api}/data`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Accept': 'application/json'
    },
    body: JSON.stringify(body)
  })

这是我的 python 代码:

@app.route('/data', methods=['POST'])
def set_dunction_data():
    if request.is_json:
        content = request.json
        data = dataapi.function1(...,content['numerator'],...)
        return make_response(jsonify(data),200)

这是我使用 SQLAlchemy 1.1.3 的列定义:

db.Column('numerator', db.String(500), nullable=True)

如果我改变

numerator: hash

numerator: "0" // or any other value with double-quotes

一切开始工作! Return 是我的期望值 / json.

这是为什么?问题出在哪里?

问题是我尝试使用的未初始化或 null/undefined 变量不知何故从视力中消失了:/