I have defined the following flow in a Mule Community Edition 3.8 application:
<flow name="post:/api/v1:application/json:api-v1-config">
<set-property propertyName="Content-Type" value="application/json" doc:name="Property"/>
<expression-component>
payload = app.registry['RestServiceBean_2.10'].postApiCall(
payload,
message);
</expression-component>
</flow>
And in the same file a mapping for an HTTP 415
<apikit:mapping statusCode="415">
<apikit:exception value="org.mule.module.apikit.exception.UnsupportedMediaTypeException" />
<set-property propertyName="Content-Type" value="application/json" doc:name="Property"/>
<set-payload value="{ "message": "Unsupported media type" }" doc:name="Unsupported media type"/>
</apikit:mapping>
Now when I send a request to that endpoint with Content-Type: application/xml
, I see an exception in the log called Flow not found for resource ...
and receive an HTTP 500 response.
What am I missing, where do I have to tell the config that it should return an HTTP 415 in such cases?