FunctionalTestCase Mule 3.6.0

三世轮回 提交于 2019-12-14 03:59:52

问题


I'm migrating my FunctionalTestCase from Mule 3.5.0 to Mule 3.6.0, when I try to post a json like:

Map properties = new HashMap(); 
properties.put("Content-Type", "application/json"); 
properties.put("http.method", "POST"); 
muleMessage.addProperties(properties, PropertyScope.OUTBOUND); 
AbstractMuleContextTestCase.muleContext.getClient().send(url, muleMessage); 

I always get NullPayload in the flow that I'm testing, how it's the proper way to do a post in the new version of Mule 3.6.0


回答1:


MuleClient has a new method now to specify the request options, including the method to be used. This is: send(String url, MuleMessage message, OperationOptions operationOptions). The operationOptions can be created in many ways, one of which is: newOptions().method("POST").build() to make a POST request.

An example of this can be found here in testHttpRedeliveryExhaustedRollbackUsingMuleClient.



来源:https://stackoverflow.com/questions/30214922/functionaltestcase-mule-3-6-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!