Forum Discussion

kpick's avatar
kpick
New Contributor
16 years ago

Test case for HTTP Headers in Response

Hi. I've tried looking into the groovy scripting a little bit, but all I've seen so far is finding the ability to read cookies from a response. What I'd like to do is to make assertions for two of the following criteria:

1) Verify the HTTP Status is 200/500/... etc for a given response
2) Verify the response Content-Type is text/xml or application/soap+xml (i.e. make sure I'm not getting back a SOAP document with text/html or something as the Content-Type)

Is there a way to do this?

-Ken-
  • Hi Ken,

    sure, add a script assertion to your request and try

    assert messageExchange.responseStatusCode == 200
    assert messageExchange.responseContentType == "text/html"

    regards!

    /Ole
    eviware.com