繁体   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