首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在颤振中多部分地请求这种格式?

如何在颤振中多部分地请求这种格式?
EN

Stack Overflow用户
提问于 2022-06-27 09:16:09
回答 2查看 31关注 0票数 0
代码语言:javascript
复制
var response = await http.post(Uri.parse(url),
      body: {
        "name": "name test",
        "about": about,
        "education[institute][0]": "ins one",
        "education[institute][1]": "ins two",
        "education[degree][0]": "deg one",
        "education[degree][1]": "deg two",
        "education[major][0]": "maj one",
        "education[major][1]": "maj two",
        "education[year][0]": "year one",
        "education[year][1]": "year two",
        "profession[position][0]": "pro one",
        "profession[position][1]": "pro two",
        "profession[company][0]": "com one",
        "profession[company][1]": "com two",
        "profession[start][0]": "star one",
        "profession[start][1]": "star two",
        "profession[end][0]": "end one",
        "profession[end][1]": "end two",
        "certification": certificate
      },
      headers: headers);
EN

回答 2

Stack Overflow用户

发布于 2022-06-27 09:36:09

你可以试试这个方法:

代码语言:javascript
复制
var uri = Uri.parse('url');
  var request = MultipartRequest('POST', uri);
  
  
  request.fields["name"] = "name test";
  request.fields["about"]= about;
  request.fields["education[institute][0]"]= "ins one";
  request.fields["education[institute][1]"]= "ins two";

  try {
      var streamedResponse = await request.send();
      var response = await Response.fromStream(streamedResponse);
      
      print(response.body);
    
      
    } catch (e) {
      rethrow;
    }
票数 1
EN

Stack Overflow用户

发布于 2022-06-27 10:20:10

,过了很长一段时间,我把它解决了。谢谢

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72769662

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档