简体   繁体   中英

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.

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:

{
    "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. It is still the same.

I've looked through the http header response, and there are some differences.

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:

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

Any advice?

EDIT

I tested with powershell Invoke-WebRequest, and I see that this is behaving the same as the Logic app HTTP action. From powershell, the header is also the same (missing Content-Encoding: gzip) and the "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.

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.

I've sovled it.

I simply put this as a header on the HTTP Action:

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

And the response message was the same as in 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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