How to use the strong-remoting/lib/shared-method.isFileType function in strong-remoting

To help you get started, we’ve selected a few strong-remoting examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github EdgeVerve / oe-cloud / lib / proxy-context.js View on Github external
ProxyContext.prototype.setReturnArgByName = function (name, value) {
  var ARG_WAS_HANDLED = true;
  var returnDesc = this.method.getReturnArgDescByName(name);
  var res = this.res;

  if (!returnDesc) {
    debug('warning: cannot set return value for arg' +
      ' (%s) without description!', name);
    return;
  }

  if (returnDesc.root) {
    this.returnsFile = SharedMethod.isFileType(returnDesc.type);
    return;
  }

  if (returnDesc.http) {
    switch (returnDesc.http.target) {
      case 'status':
        res.status(value);
        return ARG_WAS_HANDLED;
      case 'header':
        res.set(returnDesc.http.header || name, value);
        return ARG_WAS_HANDLED;
      default:
        return ARG_WAS_HANDLED;
    }
  }
};