I am using slim framework 2 etag()
to fetch cache data, all working fine i am getting the cache data with the postman or any rest client but i am getting HTTP 200 OK
response all time in the rest client but as it should be HTTP 304
when the data comes from cache
below is my slim api:
$app->get('/getNew', function () use ($app){
$app->etag('uniqueEtag12');
echo "I am updated one";
});
I don't have any idea why every time i am getting 200 OK
response code in the rest client as i am getting the cache data in the response, below is my rest client response snap
why this status code always 200 OK
why i am not getting status code 304
please help me
The
etag()
method does two things:ETag
header to the responseIf-None-Match
header with the valueuniqueEtag12
Therefore, I think that your request does not include an
If-None-Match
header.Example code:
index.php:
Test using curl.
No
If-None-Match
header: $ curl -i http://localhost:8888/helloWith an
If-None-Match
header: