Forum Discussion

briankitt's avatar
briankitt
Occasional Contributor
5 years ago

How to mock an HTTP Status with specific codes

The few posts that talk about this, must be for older versions of Soap UI, or perhaps, maybe Pro.  I am on the open source v 5.5.0.

I create a new mock response, I click the exclamation point at the top.  That does create a sample fault packet.
So far so good.
But I want to set the HTTP Status to a specific code.  Several posts indicate there are options on the left panel for setting http status code, but they are not there. I can't find any way to do it.   I tried, in desperation, to just create an http status header, with every possible spelling I could think of for http status, but nothing works.

How would I set a specific http status on this fault?
For example, I need to emulate a 401, 403, 408, 409, 500, 503 and others.   

10 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3
    There are two ways.

    1. Randomly send the response with different status code.
    2. Send a header in the request. Based on the header value, send the response.

    For both above, you can use Dispatch as Script for better control to send the response.
    • briankitt's avatar
      briankitt
      Occasional Contributor

      Thanks for answering, but I'm still unclear on exactly how to get the status into the response. 
      for #1, where do I put it?
      for #2, what header?   I've tried what I thought it should be, but it did not work, so I must have used the wrong spelling.