From e714da6f0abdf0b7c1d78be364ca7342246da74f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Tue, 20 Mar 2018 15:54:58 +0100 Subject: [PATCH] http: use more destructuring PR-URL: https://github.com/nodejs/node/pull/19481 Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Jackson Tian Reviewed-By: Luigi Pinca --- lib/http.js | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/lib/http.js b/lib/http.js index 701a5ccb86cc21..8431ab0d51ea39 100644 --- a/lib/http.js +++ b/lib/http.js @@ -21,14 +21,17 @@ 'use strict'; -const agent = require('_http_agent'); +const { Agent, globalAgent } = require('_http_agent'); const { ClientRequest } = require('_http_client'); -const common = require('_http_common'); -const incoming = require('_http_incoming'); -const outgoing = require('_http_outgoing'); -const server = require('_http_server'); - -const { Server } = server; +const { methods } = require('_http_common'); +const { IncomingMessage } = require('_http_incoming'); +const { OutgoingMessage } = require('_http_outgoing'); +const { + _connectionListener, + STATUS_CODES, + Server, + ServerResponse +} = require('_http_server'); function createServer(requestListener) { return new Server(requestListener); @@ -45,16 +48,16 @@ function get(options, cb) { } module.exports = { - _connectionListener: server._connectionListener, - METHODS: common.methods.slice().sort(), - STATUS_CODES: server.STATUS_CODES, - Agent: agent.Agent, + _connectionListener, + METHODS: methods.slice().sort(), + STATUS_CODES, + Agent, ClientRequest, - globalAgent: agent.globalAgent, - IncomingMessage: incoming.IncomingMessage, - OutgoingMessage: outgoing.OutgoingMessage, + globalAgent, + IncomingMessage, + OutgoingMessage, Server, - ServerResponse: server.ServerResponse, + ServerResponse, createServer, get, request