获取统一组图像时批量 JSON 格式错误批量、图像、错误、格式

2023-09-06 17:28:18 作者:小熊草莓酱

我正在使用请求 https://graph.microsoft.com/v1.0/$batch API 用于获取组图像,并且在批处理中,单个图像响应包含 "Content-Type":"image/pjpeg" 并且会破坏响应的 json 解析(在JSON...).

I'm using request https://graph.microsoft.com/v1.0/$batch API to fetch group images and within batch, single image response contains "Content-Type":"image/pjpeg" and that breaks json parsing of the response (unexpected token X in the JSON...).

请求:

{
  "requests": [
    {
      "id":"88aec8df-ea5e-4ad6-8534-3b1ac70693e2",
      "method":"GET",
      "url":"/groups/88aec8df-ea5e-4ad6-8534-3b1ac70693e2/photo/$value"
    },
    {
      "id":"beeadb9d-02cf-4437-ab7d-7762a58e70a6",
      "method":"GET",
      "url":"/groups/beeadb9d-02cf-4437-ab7d-7762a58e70a6/photo/$value"
    }
  ]
}

来自 Chrome 控制台的批量响应

似乎 Graph 批处理不能正确地将 pjpeg 图像进行 Base64 编码以响应 json.普通 "Content-Type":"image/jpeg" 批量图片效果很好.

Seems that Graph batch does not Base64 encode pjpeg images correctly to response json. Normal "Content-Type":"image/jpeg" images in batch works fine.

没有从已知问题中找到任何与此相关的内容.

Did not find anything related to this from known issues.

推荐答案

出于理智目的:这是批处理中的一个错误,此后已得到解决.

For sanity purposes: this was a bug in the batch processing that has been addressed since.