Skip to content
Myr

res.send() using res.json()

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 73ea5cd · Browse files · 1 file+1 added−10 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+1 added−10 removed

  • other:+1 added−10 removed

1 file+1 added−10 removed

modified:lib/response.js+1 added-10 removed
73 unmodified lines
74 if (!this.header('Content-Type')) {75 this.contentType('.bin');76 }77 } else {78 if (!this.header('Content-Type')) {79 this.charset = this.charset || 'utf-8';80 this.contentType('.json');81 }82 body = JSON.stringify(body);83 if (this.req.query.callback && this.app.set('jsonp callback')) {84 this.charset = this.charset || 'utf-8';85 this.header('Content-Type', 'text/javascript');86 body = this.req.query.callback.replace(/[^\w$.]/g, '') + '(' + body + ');';87 }78 return this.json(body, headers, status);79 }80 break;81 }82
380 unmodified lines