Skip to content

Commit a93d85b

Browse files
authored
Merge pull request webmachine#300 from stritzinger/bugfix/fix-l17-test
Use correct date for L17 test
2 parents 41fc382 + 63a4a22 commit a93d85b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

test/decision_core_test.erl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -904,10 +904,15 @@ not_modified_j18_via_h12() ->
904904

905905
%% 304 result via L17
906906
not_modified_l17() ->
907+
% Because httpd_util:rfc1123_date converts the date to GMT, it is offset by
908+
% the local time zone. To get a Last-Modified date equal to the
909+
% If-Modified-Since date we must convert it back from the RFC 1123 format.
910+
% This avoids the test case failing in any time zone "east" of GMT :-P
911+
RFC1123LastYear = httpd_util:rfc1123_date(?FIRST_DAY_OF_LAST_YEAR),
912+
DateTimeLastYear = httpd_util:convert_request_date(RFC1123LastYear),
907913
put_setting(allowed_methods, ?DEFAULT_ALLOWED_METHODS),
908-
put_setting(last_modified, ?FIRST_DAY_OF_LAST_YEAR),
914+
put_setting(last_modified, DateTimeLastYear),
909915
put_setting(expires, ?FIRST_DAY_OF_NEXT_YEAR),
910-
RFC1123LastYear = httpd_util:rfc1123_date(?FIRST_DAY_OF_LAST_YEAR),
911916
Headers = [{"If-Modified-Since", RFC1123LastYear}],
912917
{ok, Result} = httpc:request(get, {url(), Headers}, [], []),
913918
?assertMatch({{"HTTP/1.1", 304, "Not Modified"}, _, _}, Result),

0 commit comments

Comments
 (0)