1

How do I assert my HTTP Status Code in MUnit Version 2.2.1 for Mule 4?

I have checked all the vars and attributes being returned and none of them have the HTTP Status Code.

Julie
  • 63
  • 10

1 Answers1

1

It should be present in the attributes

<munit-tools:assert-that expression="#[attributes.statusCode]" is="#[MunitTools::equalTo(400)]"/>
  • Unfortunately it is not, I have searched all the attributes and vars, I googled for hours and tried all the suggestions, I retried based on your comment, and it's null. – Julie Oct 23 '19 at 17:45
  • @Julie I know that posting images is not realy the way to go, but i thought i'd check our own code for you, and it is identical to that posted by Diego. It works, but can you share the output, maybe there is something else happening. https://imgur.com/q7JEaqw – Nicky van Steensel van der Aa Oct 24 '19 at 11:22
  • I figured it out, in Mule 4 the responses seem to be tied to the HTTP Listener, in Mule 3 they were just outboundProperties. I invoke my MUnit at the APIKit Router flow so I think it can't capture the response headers or HTTP status code because of that. I am ok with not asserting it then, as I want to maintain my entry point where it is. – Julie Oct 31 '19 at 19:59