'use strict';
var Modernizr = require('modernizr');
var generateConfig = require('../util/configFromPost');

// in the case of script-less clients, we allow for the form on `/download` to POST
// the configuration used on the page. This is NOT the same as the build hash/querystring
// that is included at the top of every file. It is _only_ used when a client POSTs the form
// on the download page

var buildFromPostedQuery = function(request, reply) {
  var config = generateConfig(request.payload || request.url.search.replace('^?', ''));
  var ext = config.minify ? '.min.js' : '.js';

  Modernizr.build(config, function(build) {
    reply(build).header('Content-disposition', 'attachment; filename=modernizr-custom' + ext);
  });
};

module.exports = buildFromPostedQuery;

@@ -644,16 +644,23 @@
 y(build)
+%0A      
 .header(
@@ -668,17 +668,66 @@
 Content-
-d
+Type', 'text/javascript')%0A      .header('Content-D
 ispositi

Add content-type so Safari will download with the right file extension. Fixes #51.