wso2 / product-micro-integrator

The cloud-native configuration driven runtime that helps developers implement composite microservices.
https://wso2.com/integration/
Apache License 2.0
204 stars 221 forks source link

Add support for mocking put endpoints #3763

Open heshanpadmasiri opened 2 weeks ago

heshanpadmasiri commented 2 weeks ago

Problem

Currently we can mock GET endpoints but not PUT endpoints (not sure about other kinds like POST). We need to be able to mock PUT endpoints (and others if they are not supported).

Proposed Solution

We need to be able to do

<mock-service>
    <service-name>CreateRecordEndPoint</service-name>
    <port>9090</port>
    <context>/mock</context>
    <resources>
        <resource>
            <sub-context>/create/?updateMode=M&amp;entPriority=P</sub-context>
            <method>PUT</method>
            <response>
                <status-code>200</status-code>
                <headers>
                    <header name="Content-Type" value="application/json" />
                </headers>
                <payload>
                    <![CDATA[{"working": true}]]>
                </payload>
            </response>
        </resource>
    </resources>
</mock-service>

Alternatives

No response

Version

No response

SanojPunchihewa commented 2 weeks ago

As per the mock service creator[1] we haven't considered the PUT method. We may need to check the feasibility and add support for PUT method.

[1] - https://github.com/wso2/wso2-synapse/blob/master/modules/core/src/main/java/org/apache/synapse/unittest/MockServiceCreator.java#L129