1
votes

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
Try with send(String url, MuleMessage message, OperationOptions operationOptions), using options set up tu use POST as method. - afelisatti
Can you give me an example of how to set up to use POST method? I'm having trouble doing this. - Sérgio Abreu
Sure: newOptions().method("POST").build(). That will give you the operationsOptions you need. Let me know if it works. - afelisatti
what is the package of the class Options? - Sérgio Abreu
HttpRequestOptionsBuilder. You can check out an example usage github.com/mulesoft/mule/blob/… (testHttpRedeliveryExhaustedRollbackUsingMuleClient) - afelisatti

1 Answers

3
votes

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.