简体   繁体   English

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

[英]The image file attachment is getting displayed as blank in Report Portal

I have been trying to post a log with an image attached on report portal through postman.我一直在尝试通过邮递员在报告门户上发布带有图像的日志。 The image does gets uploaded, but it shows up as blank, and you cannot really see the image.图像确实已上传,但显示为空白,您无法真正看到图像。

图片

I'm adding the image in the request body in base64 format.我正在以 base64 格式在请求正文中添加图像。 Here's the body:这是身体:

--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--

and the headers:和标题:

图片

I'm not sure why the images won't show.我不确定为什么图像不会显示。 Is there anything wrong with the body?身体有什么问题吗? How do get the images to show up as this:如何让图像显示为:

图片

Help would be really appreciated.帮助将不胜感激。 Thanks!谢谢!

It looks like you image is not a 'PNG'.看起来您的图像不是“PNG”。 You also specified some redundant fields: itemId and uuid , please leave it blank.您还指定了一些冗余字段: itemIduuid ,请将其留空。

Here is my request, which works perfectly:这是我的要求,它完美地工作:

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

How it looks in Postman:它在 Postman 中的外观: 常见邮递员请求视图

JSON 部分

RP视图

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM