Forum Discussion

Cabation's avatar
Cabation
Visitor
5 years ago

How to return HTTP status code without description?

Hello everybody,

I try to verify a reason for an error . For this I use a mock service and send responses.

What I get is an response starting with...

 

HTTP/1.1 202 Accepted

 

What I need is a response starting with ...

HTTP/1.1 202

... without "Accepted"

Is ther a chance to get a message like this?

 

Thanks in advance!

1 Reply

  • JHunt's avatar
    JHunt
    Community Hero

    You can do this by setting up your own MockResult in the OnRequest script for the MockService.

     

    if (mockRequest.httpRequest.method == 'PUT' && mockRequest.path == '/doMyUpdatePlease') {

    mockRequest.httpResponse.setStatus(202, "") // empty Reason Phrase
    return new com.eviware.soapui.impl.rest.mock.RestMockResult(mockRequest)

    }

    In this case, you don't need to add a MockResponse to your MockService as these requests will be handled completely by the script.