如何测试发送包含 IFormFiles 列表的对象列表的 POST 调用,以便通过 Postman 上传多个文件?

问题描述

这是我的 DTO 的形状:

 public class PacketDto
    {
        public string TransmittedAt { get; set; }
        public List<Logs> Files { get; set; } = null!;

        public class Logs
        {
            public LogTypeEnum LogType { get; set; }
            public List<IFormFile> LogFiles { get; set; }
        }
    }

我一直在尝试通过邮递员测试我的端点,但是我在将 List<IFormFile> 映射到 Logs 对象时遇到了问题。其他一切都正确映射。有没有人知道我在邮递员的表单中传递数据时我做错了什么?我在构建数据时尝试了以下变体:

enter image description here

enter image description here

enter image description here

解决方法

这就是我必须在 postman enter image description here

中格式化表单数据的方式