首页 > 解决方案 > 颤动的http post请求显示状态码500,尽管它在邮递员中工作

问题描述

**flutter** 

正如您在下面的 post 方法代码中看到的,我通过 post API 为 post 传递静态数据,这些数据在 postman 中有效,但在此方法中无效

    Future addbuss() async {
    var urlpost = "https://jcien.com/api/addBusinessReceived";
    var responce = await http.post(urlpost,
    
    headers: {
      'Content-Type': 'application/json; charset=UTF-8',
      
    },
        body: jsonEncode({
          "user": "7",
          "ch_id": "1",
          "user_from": "9",
          "entry_date": "2021-05-31",
          "amount": "1234",
          "business_type": "new",
          "referral_type": "inside",
          "remarks": "demoapii",
        }));
    print(responce.statusCode);
**statusCode**
status code showing error of 500   
  }

标签: apiflutterhttp-posthttp-status-code-500

解决方案


错误消息是不言自明的:

在此处输入图像描述


推荐阅读