Postman 图像文件附件在报表门户中显示为空白

Postman 图像文件附件在报表门户中显示为空白,postman,multipartform-data,reportportal,Postman,Multipartform Data,Reportportal,我一直试图通过邮递员在报告门户上发布一个带有图片的日志。图像确实会被上传,但它显示为空白,您无法真正看到图像 我正在以base64格式将图像添加到请求正文中。这是尸体: --HereGoes Content-Disposition: form-data; name="json_request_part" Content-Type: application/json [ { "file": { "name"

我一直试图通过邮递员在报告门户上发布一个带有图片的日志。图像确实会被上传,但它显示为空白,您无法真正看到图像

我正在以base64格式将图像添加到请求正文中。这是尸体:

--HereGoes
Content-Disposition: form-data; name="json_request_part"
Content-Type: application/json

[
    {
    "file": {
      "name": "test.png"
    },
    "launchUuid": "a02bf1c3-b5c0-4209-b57a-34a48deaf266",
    "itemId": "287e26f1-7386-4ce6-b61d-c7c14eb6129d",
    "itemUuid": "287e26f1-7386-4ce6-b61d-c7c14eb6129d",
    "level": "FATAL",
    "message": "custom",
    "uuid": "90",
    "time": "2019-11-15T14:35:55.006Z"
    }
]

--HereGoes
Content-Disposition: form-data; name="file"; filename="test.png"
Content-Type: image/png
Content-Transfer-Encoding: base64

<image in base64>
--HereGoes--
——来吧
内容配置:表单数据;name=“json\u请求\u部分”
内容类型:application/json
[
{
“文件”:{
“名称”:“test.png”
},
“launchUuid”:“a02bf1c3-b5c0-4209-b57a-34a48deaf266”,
“项目ID”:“287e26f1-7386-4ce6-b61d-c7c14eb6129d”,
“项目UUID”:“287e26f1-7386-4ce6-b61d-c7c14eb6129d”,
“等级”:“致命”,
“消息”:“自定义”,
“uuid”:“90”,
“时间”:“2019-11-15T14:35:55.006Z”
}
]
--这里
内容配置:表单数据;name=“file”;filename=“test.png”
内容类型:图像/png
内容传输编码:base64
--这里--
以及标题:

我不知道为什么这些图像不会显示出来。身体有什么问题吗?如何使图像显示为这样:


非常感谢您的帮助。谢谢

看起来您的图像不是“PNG”。您还指定了一些冗余字段:
itemId
uuid
,请将其留空

这是我的要求,效果很好:

POST /api/v1/default_personal/log HTTP/1.1
Host: http://localhost:8080
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
Authorization: Bearer uuid-uuid-uuid-uuid-uuid

----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="json_request_part"

[
    {
    "file": {
      "name": "linus.png"
    },
    "launchUuid": "4a0e6613-5b93-449a-9dd2-9e1f9fce71f7",
    "itemUuid": "6f7d9d33-c6d4-49a4-b9d8-c269f288cf20",
    "level": "FATAL",
    "message": "custom",
    "time": "2020-11-11T14:35:55.006Z"
    }
]
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="file"; filename="linus.png"
Content-Type: image/png

(data)
----WebKitFormBoundary7MA4YWxkTrZu0gW
《邮递员》中的形象:


当我使用postman上的表单数据发送请求时,效果很好。只有当我像上面那样在正文中使用原始文本时,它才起作用。我用多个不同的PNG文件对此进行了测试,结果都是一样的。@Ritzies,我打赌这不是RP问题,而是postman和其他工具如何发送请求。该标准对格式和行分隔符有非常严格的限制,一个不正确的字符和整个请求将在没有任何处理的情况下被丢弃。因此,我不建议您发送您描述的原始数据。