Skip to content
Myr

.contentType -> .type() in core

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

authored by TJ Holowaychuk · committed by TJ Holowaychuk · parent 67ddb42 · Browse files · 1 file+3 added−3 removed
This commit

State

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

Diff stats

1 file+3 added−3 removed

  • other:+3 added−3 removed

1 file+3 added−3 removed

modified:lib/response.js+3 added-3 removed
75 unmodified lines
7677 switch (typeof body) {78 // response status79 case 'number':80 this.get('Content-Type') || this.contentType('.txt');80 this.get('Content-Type') || this.type('txt');81 this.statusCode = body;82 body = http.STATUS_CODES[body];83 break;84 // string defaulting to html85 case 'string':86 if (!this.get('Content-Type')) {87 this.charset = this.charset || 'utf-8';88 this.contentType('.html');88 this.type('html');89 }90 break;91 case 'boolean':92 case 'object':93 if (null == body) {94 body = '';95 } else if (Buffer.isBuffer(body)) {96 this.get('Content-Type') || this.contentType('.bin');96 this.get('Content-Type') || this.type('bin');97 } else {98 return this.json(body);99 }100 break;
541 unmodified lines