Forum Discussion

rastech1's avatar
rastech1
Occasional Contributor
14 years ago

Gettting warning for 304 status code

Hi,

While doing load test with one user

Task recorded as;



request header

GET /js/prettyCheckboxes.js HTTP/1.1

response header

HTTP/1.1 304 Not Modified



request header

GET /js/prettyCheckboxes.js HTTP/1.1



response header

HTTP/1.1 200 OK



I dont understand why a 304 status code recorded request returns 200 OK status code when running test ?



Anyone knows why this occurs ?

3 Replies

  • rastech1's avatar
    rastech1
    Occasional Contributor
    Hi,

    I know HTTP/1.1 304 Not Modified is not a real problem but the problem is it does not hapen al time.



    It just happens in some tests, there must be an answer for this.
  • Hello Rasim,



    The reason for such differences is the fact that some of the requests are conditional ones. That is, they have the "If-Modified-Since" and/or "If-None-Match" fields in the request header. A browser sends a conditional request for some resource, if this resource is present in the browser's cache. The idea is to avoid loading from server the resources that did not changed since the time they were cached.



    The first step to avoid such issues is clearing the browser cache before recording - if there is nothing in the cache, the browser will not send conditional requests.



    But some resources may be requested several times during the same recording session. So, the second and further requests may be conditional anyway. To avoid this, you can modify the recorded task - clear the "If-Modified-Since" and "If-None-Match" header fields, and change the expected response for such requests to 200 (on the Response tab). Clearing the fields should make the server always return the 200 response with the actual resource contents.



    I hope this helps.