簡體   English   中英

為什么 Azure 邏輯應用 HTTP 模塊會修改響應負載?

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

我正在嘗試使用內置的 HTTP 模塊從帶有邏輯應用程序的票務系統中獲取數據。

使用郵遞員進行測試時,我得到以下響應:

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 標頭響應,發現有一些差異。

郵差:

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

天藍色 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"

邏輯應用程序中似乎缺少“內容編碼:gzip”,但我不知道為什么這會影響整體響應結構。 還有如何解決這個問題。

我試圖啟用“允許分塊”,但沒有任何運氣。

我知道我可能會創建一個 Azure 函數來解決這個問題,但我現在試圖避免這種情況。

有什么建議嗎?

編輯

我使用 powershell Invoke-WebRequest 進行了測試,我發現這與邏輯應用 HTTP 操作的行為相同。 從 powershell 中,標頭也是相同的(缺少 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

我真的很想了解標題級別的區別,因為這是響應之間的唯一區別,也是 application/vnd.api+json 和 Content-Encoding: gzip 在這里所做的。

我已經解決了。

我只是將其作為 HTTP 操作的標頭:

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

並且響應消息與 Postman 中的相同。

這仍然沒有回答為什么它的行為不同,因為在我嘗試的所有方法中,沒有一個請求標頭具有這個值。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM