Front end of the Slack clone application.

downloadoptions.js 737B

1234567891011121314151617181920212223242526272829303132
  1. var proxy = require('./proxy'),
  2. userAgent = require('./useragent');
  3. /**
  4. * The options passed to request when downloading the bibary
  5. *
  6. * There some nuance to how request handles options. Specifically
  7. * we've been caught by their usage of `hasOwnProperty` rather than
  8. * falsey checks. By moving the options generation into a util helper
  9. * we can test for regressions.
  10. *
  11. * @return {Object} an options object for request
  12. * @api private
  13. */
  14. module.exports = function() {
  15. var options = {
  16. rejectUnauthorized: false,
  17. timeout: 60000,
  18. headers: {
  19. 'User-Agent': userAgent(),
  20. },
  21. encoding: null,
  22. };
  23. var proxyConfig = proxy();
  24. if (proxyConfig) {
  25. options.proxy = proxyConfig;
  26. }
  27. return options;
  28. };