为什么 Azure 逻辑应用 HTTP 模块修改响应有效负载?

Why is the Azure Logic app HTTP module modifying the response payload?

我正在尝试使用 built-in HTTP 模块从带有逻辑应用程序的票务系统中获取数据。

使用 postman 进行测试时,我得到以下响应:

GET: https://ticketsystem/api/ticket/{{number}}

{
"tickets": [
    {
        "links": {
            "data1": {
                "id": 4
            },
            "data2": {
                "id": 3
            },
            "data3": {
                "id": 969
            }
            ...
        },
        "data1Id": 4,
        "data2Id": 3,
        "data3Id": 969,
        "att1": 1,
        "att1": 2,
        "att1": 3,
        "att1": 4
        ....
    }
]}

但是,当尝试通过 HTTP 逻辑应用程序模块时,这是响应:

{
    "data1Id": 4,
    "data2Id": 3,
    "data3Id": 969,
    "att1": 1,
    "att1": 2,
    "att1": 3,
    "att1": 4
    ...
}

其他一切都一样,我什至尝试了一个新的逻辑应用程序和一个完全不同的 azure 帐户。还是老样子

我查看了 http header 响应,发现存在一些差异。

邮递员:

Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/vnd.api+json; charset=utf-8
Content-Encoding: gzip
Expires: -1
Vary: Accept-Encoding
Server: Microsoft-IIS/10.0
X-PS-ActionTime: 00:00:00.0022451
X-Frame-Options: deny
X-XSS-Protection: 1; mode=block
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Date: Wed, 16 Jun 2021 09:41:50 GMT
Content-Length: 819

Azure HTTP:

"Pragma": "no-cache",
"Vary": "Accept-Encoding",
"X-PS-ActionTime": "00:00:00.0022021",
"X-Frame-Options": "deny",
"X-XSS-Protection": "1; mode=block",
"Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload",
"Cache-Control": "no-cache",
"Date": "Wed, 16 Jun 2021 09:43:27 GMT",
"Server": "Microsoft-IIS/10.0",
"Content-Type": "application/json; charset=utf-8",
"Expires": "-1",
"Content-Length": "1733"

逻辑应用程序中似乎缺少“Content-Encoding: gzip”,但我不知道为什么这会影响整体响应结构。还有如何解决这个问题。

我尝试启用“允许分块”,但没有成功。

我知道我可能会创建一个 Azure 函数来解决这个问题,但我现在正在努力避免这种情况。

有什么建议吗?

编辑

我使用 powershell Invoke-WebRequest 进行了测试,我发现这与逻辑应用 HTTP 操作的行为相同。 在 powershell 中,header 也是相同的(缺少 Content-Encoding:gzip)和 "Content-Type" = "application/json; charset=utf-8"

但是,当使用 python (3.9) 和请求模块进行测试时,它会吐出与邮递员相同的数据。

Content-Type: application/vnd.api+json; charset=utf-8
Content-Encoding: gzip

我真的很想了解 header 级别的区别,因为这是响应之间的唯一区别,也是 application/vnd.api+json 和 Content-Encoding:这里是 gzip。

你检查了吗:

https://docs.microsoft.com/en-us/azure/connectors/connectors-native-http#omitted-http-headers

我也看到了对此的反馈:https://feedback.azure.com/forums/287593-logic-apps/suggestions/42578674-enable-support-for-content-type-header-in-http-get

我解决了。

我只是将其作为 header 放在 HTTP 操作中:

"Accept": "application/vnd.api+json; charset=utf-8"

并且响应消息与 Postman 中的相同。

这仍然没有回答 为什么 它的行为不同,因为请求 headers 的 none 在我的所有方法中都有这个值试过了。