Skip to content
Myr

Defaulting mimetype to "application/octet-stream"

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by visionmedia · committed by visionmedia · parent 73d1d67 · Browse files · 3 files+16 added−8 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+16 added−8 removed

  • tests:+2 added−2 removed
  • other:+14 added−6 removed

3 files+16 added−8 removed

modified:lib/express.core.js+13 added-5 removed
34 unmodified lines
35 */36 37 start : function(port) {38 this.server.listen(port || 3000, function(request, response){39 // TODO: hooks / modules39 // TODO: middleware40 request.headers = Express.arrayToHash(request.headers)41 request.cookie = Express.parseCookie(request.headers['Cookie'])42 request.uri.params = Express.parseNestedParams(request.uri.params)43 request.uri.path = Express.normalizePath(request.uri.path)44 Express.request = request45 Express.response.cookie = request.cookie46 Express.response.body = Express.callRouteFor(request)47 response.sendHeader(Express.response.status, Express.prepareResponseHeaders(Express.hashToArray(Express.response.headers)))47 Express.prepareCookie()48 response.sendHeader(Express.response.status, Express.hashToArray(Express.response.headers))49 response.sendBody(Express.response.body || '')50 response.finish()51 })52 },
13 unmodified lines
66 puts('Express listening to http://localhost:' + port)67 }68 },69 69 prepareResponseHeaders : function(headers) {70 return headers70 prepareCookie : function() {71 p (this.response)72 var cookie = []73 for (var key in this.response.cookie)74 if (this.response.cookie.hasOwnProperty(key))75 cookie.push(key + '=' + this.response.cookie[key])76 if (cookie.length)77 this.header('Set-Cookie', cookie.join('; '))78 },79 80 /**81 * Return an associative array generated
390 unmodified lines
472})473474get('cookies', function(){475 cookie('foo', 'bar')476 cookie('some-thing', 'some value')477 cookie('max-age', '1000')478 p(request.headers)479 p(response.headers)471 p(response.cookie)480 'Wahoo!'481})482483get('articles', function(){
16 unmodified lines
modified:lib/express.mime.js+1 added-1 removed
modified:spec/spec.mime.js+2 added-2 removed