Skip to content

Instantly share code, notes, and snippets.

@opichals
Created January 4, 2012 08:51
Show Gist options
  • Save opichals/1559168 to your computer and use it in GitHub Desktop.
Save opichals/1559168 to your computer and use it in GitHub Desktop.
Google Chrome Frame No Content on POST 204
https://gist.github.com/1559168
Reproduction stuff for POST resulting in 204 'No Content' on the server returns XMLHttpRequest result == 0.
The example uses YUI3, but it was verified that the result status of 0 comes from the XMLHttpRequest object status field.
* install nodejs
Download and install the appropriate package from nodejs.org
* install express (nodejs web stack)
do 'npm install -g express'
* run the server
'node ./server.js'
* point your browser to
http://localhost:3000
@opichals
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>NoContent</title>
<script type='text/javascript' src='http://yui.yahooapis.com/3.4.1/build/yui/yui.js'></script>
<script type='text/javascript'>//<![CDATA[·
YUI().use('io', function(Y) {
Y.io('/test/xyz', {
method: 'POST',
on: {
success: function(t, r) {
alert('res: ' + r.status);
},
failure: function(t, r) {
alert('failure res: ' + r.status);
}
}
});
});
//]]>··
</script>
</head>
<body>
</body>
</html>
var express = require('express');
var app = express.createServer();
app.configure('development', function(){
app.use(express.static(__dirname + '/'));
app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
});
app.post('/test/*', function(req, res){
console.log('test');
res.header('X-Test', 'Content');
res.header('Content-Length', 0);
res.send(204);
});
app.listen(3000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment