Created
April 22, 2013 13:49
-
-
Save joaomoreno/5435137 to your computer and use it in GitHub Desktop.
Firebug caching issue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "firebug-bug", | |
"version": "0.0.1", | |
"dependencies": { | |
"express": ">= 3.0.0" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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