lib/response.js
function () {
    var body;
    var app = this.app;

    // If status provide, set that, and set `body` to the content correctly
    if (typeof arguments[0] === 'number') {
      this.status(arguments[0]);
      body = arguments[1];
    } else {
      body = arguments[0];
    }

    var type = this.get('Content-Type');

    if (!body && type !== 'application/json') {
      body = utils.STATUS_CODES[this.statusCode];
      if (!type)
        this.type('txt');
    }
    else if (typeof body === 'string') {
      if (!type) {
        this.charset = this.charset || 'utf-8';
        this.type('html');
      }
    }
    else if (typeof body === 'object') {
      if (body === null)
        body = '';
      else if (!type || type === 'application/json') {
        this.contentType('application/json');
        // Cast object to string to normalize response
        var replacer = app.get('json replacer');
        var spaces = app.get('json spaces');
        body = JSON.stringify(body, replacer, spaces);
      }
    }

    this.end(body);
    return this;
  }
function () {
    var body;
    var app = this.app;

    // If status provide, set that, and set `body` to the content correctly
    if (typeof arguments[0] === 'number') {
      this.status(arguments[0]);
      body = arguments[1];
    } else {
      body = arguments[0];
    }

    var type = this.get('Content-Type');

    if (!body && type !== 'application/json') {
      body = utils.STATUS_CODES[this.statusCode];
      if (!type)
        this.type('txt');
    }
    else if (typeof body === 'string') {
      if (!type) {
        this.charset = this.charset || 'utf-8';
        this.type('html');
      }
    }
    else if (typeof body === 'object') {
      if (body === null)
        body = '';
      else if (!type || type === 'application/json') {
        this.contentType('application/json');
        // Cast object to string to normalize response
        var replacer = app.get('json replacer');
        var spaces = app.get('json spaces');
        body = JSON.stringify(body, replacer, spaces);
      }
    }

    this.end(body);
    return this;
  }
Sends a response

Examples:
res.send({})
res.send('text')
res.send(404, 'Message')
res.send(200)

@param {Mixed} body or status code
@param {Mixed} body
@return {Response}