Skip to content

Instantly share code, notes, and snippets.

@joaomoreno
Created April 22, 2013 13:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joaomoreno/5435137 to your computer and use it in GitHub Desktop.
Save joaomoreno/5435137 to your computer and use it in GitHub Desktop.
Firebug caching issue
<html>
<body>
<div id="result"></div>
<script>
var div = document.getElementById('result');
var req = new XMLHttpRequest();
req.onload = function () {
var req2 = new XMLHttpRequest();
req2.onload = function () {
div.innerHTML = this.responseText;
};
req2.open('get', '/foo', true);
req2.send();
};
req.open('get', '/foo', true);
req.setRequestHeader('Accept', 'text/plain');
req.send();
</script>
</body>
</html>
{
"name": "firebug-bug",
"version": "0.0.1",
"dependencies": {
"express": ">= 3.0.0"
}
}
var express = require('express');
var app = express();
app.get('/', function(req, res) {
res.sendfile('index.html');
});
app.get('/foo', function (req, res) {
if (req.get('accept') === 'text/plain') {
res.set('Content-Type', 'text/plain');
res.send('bad - you should not be reading this');
} else {
res.set('Content-Type', 'application/octet-stream');
res.send('ok!');
}
});
app.listen(3000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment