簡體   English   中英

WSO2 EI 6.6 Content-Type 是 null 用於 GET 請求

[英]WSO2 EI 6.6 Content-Type is null for GET requests

我在 WSO2 EI 集成工作室中定義了一個 API 端點。 當我向這個端點發送一個GET請求時,請求的$axis2:ContentType header 一旦進入 EI(inSequence 的開頭)就會得到 null。 有沒有辦法保存這個 header 並將其發送出 EI。 知道怎么做嗎?

注意:這不會發生在POST請求中。

API 端點

<?xml version="1.0" encoding="UTF-8"?>
<api context="/eirouter_test" name="eirouter_test" xmlns="http://ws.apache.org/ns/synapse">
    <resource methods="POST GET">
        <inSequence>
            <log level="custom">
                <property expression="$axis2:ContentType" name="original-content-type" />
            </log>
            
            <respond description="Send result to the client"/>
        </inSequence>
        <outSequence />
        <faultSequence />
    </resource>
</api>

請求 CURL

curl --location --request GET 'http://localhost:8290/eirouter_test/eb805bbe-6c3e-414d-a380-857b6f89607c' \
--header 'Content-Type: application/json'

EI 日志

[2021-06-01 10:54:41,457]  INFO {LogMediator} - {api:eirouter_test} original-content-type = null

簡而言之, Content-Type HTTP header 應該只為PUTPOST請求設置。 有一個非常相似的問題: 對於 HTTP GET 請求,我需要一個內容類型 header 嗎? 有很好的解釋。

所以這不是 WSO2 問題,而是 HTTP 與Content-Type header 的工作原理。

暫無
暫無

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

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