Forum Discussion

patim's avatar
patim
Occasional Contributor
13 years ago

want to test : If-Modified-Since: {HTTP-Date}

HI,

I am new to SOUP UI and currently using SOUP UI Pro trial version.

I am using for testing REST APIs.

I want to Fetch entity and check that if its changed after a specified date (check point in test SOUP UI PRO), then I should get a per-difined result code.

How I am going to specify that date in SOUP-UI Pro ?

For example if the requested entity has changed after 12/08/2012, then I showed get 304.

Thanks in Advance

7 Replies

  • MartinSpamer's avatar
    MartinSpamer
    Frequent Contributor
    Try a Groovy Script Assertion something like this.


    messageExchange.getResponseHeaders()
    modifiedSince = responseHeaders."If-Modified-Since"
    log.info modifiedSince
  • MartinSpamer's avatar
    MartinSpamer
    Frequent Contributor

    def today= new Date()
    def responseHeaders = messageExchange.getResponseHeaders()
    def modifiedSince = responseHeaders."If-Modified-Since"
    assert modifiedSince.before( today )
  • patim's avatar
    patim
    Occasional Contributor
    If-Modified-Since: {HTTP-Date}

    If the requested entity exists and has not changed since the date provided by the client, then a result code of 304 (Not Modified) will be returned with an empty body.

    I am sending the following request ;


    GET /entities/{user}/{session}/{entity-id}

    and need to specified the condition for this Get request is that if modified date is not changed since the date provided by the client then the result code should be 304.

    I have added a requests header "If-Modified-on" with value "2012-18-15" but not getting the expected 304 result code.

    (Modified date on response is 13-08-2012)

    Please help
  • patim's avatar
    patim
    Occasional Contributor
    I updated the date to following format:

    Sun, 06 Nov 1994 08:49:37 GMT, still I am not getting 304.

    I am not sure how add If-Modified-Since header to request to test conditional Get ?

    Can any one help to explain the correct step/procedure to test conditional Get with If-Modified-Since for REST web-service using SOAP UI Pro ??