简体   繁体   English

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

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

I'm trying to fetch data from a ticketing system with logic app, using the built-in HTTP module.我正在尝试使用内置的 HTTP 模块从带有逻辑应用程序的票务系统中获取数据。

When testing with postman, I get the following response:使用邮递员进行测试时,我得到以下响应:

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
        ....
    }
]}

But, when trying through the HTTP logic app module, this is the response:但是,当尝试通过 HTTP 逻辑应用程序模块时,这是响应:

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

Everything else is the same, I have even tried in a new logic app and a totally different azure account.其他一切都一样,我什至在一个新的逻辑应用程序和一个完全不同的 azure 帐户中尝试过。 It is still the same.它仍然是一样的。

I've looked through the http header response, and there are some differences.我查看了 http 标头响应,发现有一些差异。

Postman:邮差:

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:天蓝色 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"

It looks like the "Content-Encoding: gzip" is missing from logic app, but I do not know why this is affecting the overall response structure.逻辑应用程序中似乎缺少“内容编码:gzip”,但我不知道为什么这会影响整体响应结构。 Also how to fix this issue.还有如何解决这个问题。

I have tried to enable "Allow chunking", without any luck.我试图启用“允许分块”,但没有任何运气。

I understand that I might create an Azure Function to go around this, but I'm trying to avoid that for now.我知道我可能会创建一个 Azure 函数来解决这个问题,但我现在试图避免这种情况。

Any advice?有什么建议吗?

EDIT编辑

I tested with powershell Invoke-WebRequest, and I see that this is behaving the same as the Logic app HTTP action.我使用 powershell Invoke-WebRequest 进行了测试,我发现这与逻辑应用 HTTP 操作的行为相同。 From powershell, the header is also the same (missing Content-Encoding: gzip) and the "Content-Type" = "application/json; charset=utf-8"从 powershell 中,标头也是相同的(缺少 Content-Encoding: gzip)和 "Content-Type" = "application/json; charset=utf-8"

But, when testing with python (3.9) with the request module, then it's spitting out the same data as postman.但是,当使用带有请求模块的 python (3.9) 进行测试时,它会吐出与邮递员相同的数据。

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

I am really trying to understand the difference here on the header level, as this is the only difference between the responses, and also what application/vnd.api+json and Content-Encoding: gzip does here.我真的很想了解标题级别的区别,因为这是响应之间的唯一区别,也是 application/vnd.api+json 和 Content-Encoding: gzip 在这里所做的。

I've sovled it.我已经解决了。

I simply put this as a header on the HTTP Action:我只是将其作为 HTTP 操作的标头:

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

And the response message was the same as in Postman.并且响应消息与 Postman 中的相同。

This still does not answer why it is behaving differently, since none of the request headers had this value in all of the metodes I tried.这仍然没有回答为什么它的行为不同,因为在我尝试的所有方法中,没有一个请求标头具有这个值。

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

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