0

I'm having an API endpoint defined in WSO2 EI Integration studio. When I send this endpoint a GET request, the $axis2:ContentType header of the request is getting null as soon as it comes inside the EI (Beginning of inSequence) . Is there a way to preserve this header and send it out of the EI. Any idea how to do this ?

NOTE: This is not happening for POST requests.

API endpoint

<?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>

Request CURL

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

EI Logs

[2021-06-01 10:54:41,457]  INFO {LogMediator} - {api:eirouter_test} original-content-type = null
Community
  • 1
  • 1
rajeevbk
  • 55
  • 7

1 Answers1

0

In short answer, the Content-Type HTTP header should be set only for PUT and POST requests. There was very similar question: Do I need a content-type header for HTTP GET requests? with very good explanations.

So that is not WSO2 problem, but that is how works HTTP with Content-Type header.

tmoasz
  • 1,244
  • 2
  • 10
  • 15