Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a basic HTTP memory cache #4117

Closed
wants to merge 15 commits into from
Closed
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Ensure that requests are cached based on their request headers.

  • Loading branch information
jdm committed Nov 27, 2014
commit 8c602bc0c33a991016f8eda4c20a5a1dfc95df48
@@ -12,9 +12,14 @@ function reset_stats() {
is(x.status, 200, 'resetting stats should succeed');
}

function fetch(url) {
function fetch(url, headers) {
var x = new XMLHttpRequest();
x.open('GET', url, false);
if (headers) {
for (var i = 0; i < headers.length; i++) {
x.setRequestHeader(headers[i][0], headers[i][1]);
}
}
x.send();
is(x.status, 200, 'fetching ' + url + ' should succeed ');
}
@@ -0,0 +1,14 @@
<html>
<head>
<script src="harness.js"></script>
<script src="netharness.js"></script>
</head>
<body>
<script>
reset_stats();
fetch('resources/helper.html');
fetch('resources/helper.html', [['X-User', 'foo']]);
assert_requests_made('resources/helper.html', 2);
</script>
</body>
</html>
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.