【问题标题】:How to send array via postman in POST request如何在POST请求中通过邮递员发送数组
【发布时间】:2021-02-18 20:32:13
【问题描述】:

我想在 POST 请求中通过邮递员发送数组。我想发送这样的数据

{
    "users": [1, 2]
}

我读了这篇文章Is it possible to send an array with the Postman Chrome extension?

并复制,但收到错误(见图)。 我该如何解决这个错误?

我正在使用 django rest 框架,服务器回答了这个问题

request["users"] is None

【问题讨论】:

  • 端点需要json还是formdata?

标签: django-rest-framework postman


【解决方案1】:

您不能通过 formdata 发送数组,如果您的端点需要 json 则将其作为 body>raw>json 发送:

【讨论】:

  • 谢谢,它帮助了我。但是可以使用“来自数据”吗?
  • 表单数据不支持数组
猜你喜欢
  • 2021-12-11
  • 2023-02-20
  • 2018-03-17
  • 2018-10-07
  • 1970-01-01
  • 1970-01-01
  • 2021-12-14
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多