Reputation: 47
i have a flow where using http I have a GET call where it hits a like like
https://localhost:8081/ref/{ID}
I know i can get this parameter in code by using mel like:
#[message.inboundProperties.'http.uri.params'.ID]
I need to mock the uri params when i set the message but have not been sucessful. i have tried setting in the "set message" using this name
'http.uri.params'.ID
but it seems to error out when i run the test.
this is on mule server 3.7.3 using munit flows
Upvotes: 0
Views: 2695
Reputation: 31
@ksmo92 you can try the following code. It worked well for me.
<munit:set payload="#['']" doc:name="Set http.uri.params">
<munit:inbound-properties>
<munit:inbound-property key="http.uri.params" value="#[['name': 'Anu']]"/>
</munit:inbound-properties>
</munit:set>
Upvotes: 0
Reputation: 2475
Remember that the http.uri.params
inbound property actually contains a Map
, which in turn contains entries that represent the actual parameters.
You will need to set a mock inbound property named http.uri.params
whose value is a Map that contains an entry with key "ID" and the value you want. Remember that in MEL, you can create a map using [key1 : value1, key2 : value2, . . .]
.
Like so:
<mock:inbound-properties>
<mock:inbound-property key="http.uri.params" value="#[['ID': '123']]"/>
</mock:inbound-properties>
Upvotes: 1