http.js 1.2 KB

1234567891011121314151617181920
  1. var http = require("http");
  2. var promisify = require("./_promisify.js");
  3. var bind = function(c, f) { return f && f.bind(c); };
  4. Object.defineProperties(module.exports, {
  5. Agent: { enumerable: true, value: http.Agent },
  6. Client: { enumerable: true, value: http.Client },
  7. ClientRequest: { enumerable: true, value: http.ClientRequest },
  8. IncomingMessage: { enumerable: true, value: http.IncomingMessage },
  9. METHODS: { enumerable: true, value: http.METHODS },
  10. OutgoingMessage: { enumerable: true, value: http.OutgoingMessage },
  11. STATUS_CODES: { enumerable: true, value: http.STATUS_CODES },
  12. Server: { enumerable: true, value: http.Server },
  13. ServerResponse: { enumerable: true, value: http.ServerResponse },
  14. //_connectionListener: // skipping
  15. createClient: { enumerable: true, value: bind(http, http.createClient) },
  16. createServer: { enumerable: true, value: bind(http, http.createServer) },
  17. get: { enumerable: true, value: promisify(http, http.get, 1, {"returnsObject":true}) },
  18. globalAgent: { enumerable: true, get: function() { return http.globalAgent; }, set: function(v) { http.globalAgent = v; } },
  19. request: { enumerable: true, value: promisify(http, http.request, 1, {"returnsObject":true}) },
  20. });