From 4cd57de4f7b2dd9455400a66cad9027c6702c074 Mon Sep 17 00:00:00 2001 From: David Shafer Date: Wed, 21 Nov 2018 14:24:54 -0600 Subject: [PATCH] Additional checks for Cache-Control header --- md-query.robot | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/md-query.robot b/md-query.robot index 8a2b21e..64f73c3 100644 --- a/md-query.robot +++ b/md-query.robot @@ -51,7 +51,27 @@ Variables variables.py ${resp}= Conditional Get Entity baseUrl=${BASE_URL} identifier=${ENTITY_ID_ENCODED} etag=${etag} Should Be Equal As Strings ${resp.status_code} 304 msg=SHOULD return HTTP status code 304 -# 4.2 Content Caching +4.2 Content Caching + [Tags] optional + # "Responders SHOULD include cache control information with successful + # (200 status code) responses, assuming the responder knows when + # retrieved metadata is meant to expire." + ${resp}= Get Entity baseUrl=${BASE_URL} identifier=${ENTITY_ID_ENCODED} + Should Be Equal As Strings ${resp.status_code} 200 + Dictionary Should Contain Key ${resp.headers} cache-control msg=SHOULD return Cache-Control header with Success response + # "When cache controls are used only the 'max-age' directive SHOULD be used." + ${directive}= Get From Dictionary ${resp.headers} cache-control + Should Start With ${directive} max-age= msg=Only the 'max-age' directive SHOULD be used + + # "The responder SHOULD also include cache control information with 404 Not + # Found responses. This allows the requester to create and maintain a + # negative-response cache." + ${resp}= Get Entity baseUrl=${BASE_URL} identifier=foo + Should Be Equal As Strings ${resp.status_code} 404 + Dictionary Should Contain Key ${resp.headers} cache-control msg=SHOULD return Cache-Control header with Not Found response + # "When cache controls are used only the 'max-age' directive SHOULD be used." + ${directive}= Get From Dictionary ${resp.headers} cache-control + Should Start With ${directive} max-age= msg=Only the 'max-age' directive SHOULD be used 4.3 Content Compression ${resp}= Get Entity With Gzip baseUrl=${BASE_URL} identifier=${ENTITY_ID_ENCODED}