var url = "http://www.alba.co.kr/";
request.get( { uri : url, headers : { 'Host' : "www.alba.co.kr" } } , function(err, response, body) { console.log(body); } );
Å×½ºÆ® ÄÚµåÀε¥ ¾Ë¼ö°¡ ¾ø³×¿ä.
########response##########
IncomingMessage { _readableState: ReadableState { objectMode: false, highWaterMark: 16384, buffer: [], length: 0, pipes: null, pipesCount: 0, flowing: true, ended: true, endEmitted: true, reading: false, sync: true, needReadable: false, emittedReadable: false, readableListening: false, resumeScheduled: false, defaultEncoding: 'utf8', ranOut: false, awaitDrain: 0, readingMore: false, decoder: null, encoding: null }, readable: false, domain: null, _events: { end: [ [Function: responseOnEnd], [Function], [Function], [Function] ], close: [ [Function], [Function] ], data: [Function], error: [Function] }, _eventsCount: 4, _maxListeners: undefined, socket: Socket { _connecting: false, _hadError: false, _handle: null, _parent: null, _host: 'www.alba.co.kr', _readableState: ReadableState { objectMode: false, highWaterMark: 16384, buffer: [], length: 0, pipes: null, pipesCount: 0, flowing: true, ended: false, endEmitted: false, reading: true, sync: false, needReadable: true, emittedReadable: false, readableListening: false, resumeScheduled: false, defaultEncoding: 'utf8', ranOut: false, awaitDrain: 0, readingMore: false, decoder: null, encoding: null }, readable: false, domain: null, _events: { end: [Object], finish: [Function: onSocketFinish], _socketEnd: [Function: onSocketEnd], free: [Function: onFree], close: [Object], agentRemove: [Function: onRemove], drain: [Function: ondrain], error: [Object] }, _eventsCount: 8, _maxListeners: 0, _writableState: WritableState { objectMode: false, highWaterMark: 16384, needDrain: false, ending: true, ended: true, finished: true, decodeStrings: false, defaultEncoding: 'utf8', length: 0, writing: false, corked: 0, sync: false, bufferProcessing: false, onwrite: [Function], writecb: null, writelen: 0, bufferedRequest: null, lastBufferedRequest: null, pendingcb: 0, prefinished: true, errorEmitted: false, bufferedRequestCount: 0, corkedRequestsFree: [Object] }, writable: false, allowHalfOpen: false, destroyed: true, bytesRead: 363, _bytesDispatched: 59, _sockname: null, _pendingData: null, _pendingEncoding: '', server: null, _server: null, parser: null, _httpMessage: ClientRequest { domain: null, _events: [Object], _eventsCount: 4, _maxListeners: undefined, output: [], outputEncodings: [], outputCallbacks: [], outputSize: 0, writable: true, _last: true, chunkedEncoding: false, shouldKeepAlive: false, useChunkedEncodingByDefault: false, sendDate: false, _removedHeader: {}, _contentLength: 0, _hasBody: true, _trailer: '', finished: true, _headerSent: true, socket: [Circular], connection: [Circular], _header: 'GET / HTTP/1.1\r\nHost: www.alba.co.kr\r\nConnection: close\r\n\r\n', _headers: [Object], _headerNames: [Object], _onPendingData: null, agent: [Object], socketPath: undefined, method: 'GET', path: '/', parser: null, res: [Circular] }, read: [Function], _consuming: true, _idleNext: null, _idlePrev: null, _idleTimeout: -1 }, connection: Socket { _connecting: false, _hadError: false, _handle: null, _parent: null, _host: 'www.alba.co.kr', _readableState: ReadableState { objectMode: false, highWaterMark: 16384, buffer: [], length: 0, pipes: null, pipesCount: 0, flowing: true, ended: false, endEmitted: false, reading: true, sync: false, needReadable: true, emittedReadable: false, readableListening: false, resumeScheduled: false, defaultEncoding: 'utf8', ranOut: false, awaitDrain: 0, readingMore: false, decoder: null, encoding: null }, readable: false, domain: null, _events: { end: [Object], finish: [Function: onSocketFinish], _socketEnd: [Function: onSocketEnd], free: [Function: onFree], close: [Object], agentRemove: [Function: onRemove], drain: [Function: ondrain], error: [Object] }, _eventsCount: 8, _maxListeners: 0, _writableState: WritableState { objectMode: false, highWaterMark: 16384, needDrain: false, ending: true, ended: true, finished: true, decodeStrings: false, defaultEncoding: 'utf8', length: 0, writing: false, corked: 0, sync: false, bufferProcessing: false, onwrite: [Function], writecb: null, writelen: 0, bufferedRequest: null, lastBufferedRequest: null, pendingcb: 0, prefinished: true, errorEmitted: false, bufferedRequestCount: 0, corkedRequestsFree: [Object] }, writable: false, allowHalfOpen: false, destroyed: true, bytesRead: 363, _bytesDispatched: 59, _sockname: null, _pendingData: null, _pendingEncoding: '', server: null, _server: null, parser: null, _httpMessage: ClientRequest { domain: null, _events: [Object], _eventsCount: 4, _maxListeners: undefined, output: [], outputEncodings: [], outputCallbacks: [], outputSize: 0, writable: true, _last: true, chunkedEncoding: false, shouldKeepAlive: false, useChunkedEncodingByDefault: false, sendDate: false, _removedHeader: {}, _contentLength: 0, _hasBody: true, _trailer: '', finished: true, _headerSent: true, socket: [Circular], connection: [Circular], _header: 'GET / HTTP/1.1\r\nHost: www.alba.co.kr\r\nConnection: close\r\n\r\n', _headers: [Object], _headerNames: [Object], _onPendingData: null, agent: [Object], socketPath: undefined, method: 'GET', path: '/', parser: null, res: [Circular] }, read: [Function], _consuming: true, _idleNext: null, _idlePrev: null, _idleTimeout: -1 }, httpVersionMajor: 1, httpVersionMinor: 1, httpVersion: '1.1', complete: true, headers: { 'cache-control': 'Private', pragma: 'No-Cache', 'content-length': '0', 'content-type': 'text/html; Charset=euc-kr', expires: 'Thu, 16 Jun 2016 17:50:54 GMT', server: 'Microsoft-IIS/7.5', 'set-cookie': [ 'REFERG=; path=/', 'ASPSESSIONIDSCQABTTS=AIPCOEEBDFEJOGEFGMHAHLLL; path=/' ], 'x-powered-by': 'ASP.NET', date: 'Thu, 16 Jun 2016 17:51:53 GMT', connection: 'close' }, rawHeaders: [ 'Cache-Control', 'Private', 'Pragma', 'No-Cache', 'Content-Length', '0', 'Content-Type', 'text/html; Charset=euc-kr', 'Expires', 'Thu, 16 Jun 2016 17:50:54 GMT', 'Server', 'Microsoft-IIS/7.5', 'Set-Cookie', 'REFERG=; path=/', 'Set-Cookie', 'ASPSESSIONIDSCQABTTS=AIPCOEEBDFEJOGEFGMHAHLLL; path=/', 'X-Powered-By', 'ASP.NET', 'Date', 'Thu, 16 Jun 2016 17:51:53 GMT', 'Connection', 'close' ], trailers: {}, rawTrailers: [], upgrade: false, url: '', method: null, statusCode: 200, statusMessage: 'OK', client: Socket { _connecting: false, _hadError: false, _handle: null, _parent: null, _host: 'www.alba.co.kr', _readableState: ReadableState { objectMode: false, highWaterMark: 16384, buffer: [], length: 0, pipes: null, pipesCount: 0, flowing: true, ended: false, endEmitted: false, reading: true, sync: false, needReadable: true, emittedReadable: false, readableListening: false, resumeScheduled: false, defaultEncoding: 'utf8', ranOut: false, awaitDrain: 0, readingMore: false, decoder: null, encoding: null }, readable: false, domain: null, _events: { end: [Object], finish: [Function: onSocketFinish], _socketEnd: [Function: onSocketEnd], free: [Function: onFree], close: [Object], agentRemove: [Function: onRemove], drain: [Function: ondrain], error: [Object] }, _eventsCount: 8, _maxListeners: 0, _writableState: WritableState { objectMode: false, highWaterMark: 16384, needDrain: false, ending: true, ended: true, finished: true, decodeStrings: false, defaultEncoding: 'utf8', length: 0, writing: false, corked: 0, sync: false, bufferProcessing: false, onwrite: [Function], writecb: null, writelen: 0, bufferedRequest: null, lastBufferedRequest: null, pendingcb: 0, prefinished: true, errorEmitted: false, bufferedRequestCount: 0, corkedRequestsFree: [Object] }, writable: false, allowHalfOpen: false, destroyed: true, bytesRead: 363, _bytesDispatched: 59, _sockname: null, _pendingData: null, _pendingEncoding: '', server: null, _server: null, parser: null, _httpMessage: ClientRequest { domain: null, _events: [Object], _eventsCount: 4, _maxListeners: undefined, output: [], outputEncodings: [], outputCallbacks: [], outputSize: 0, writable: true, _last: true, chunkedEncoding: false, shouldKeepAlive: false, useChunkedEncodingByDefault: false, sendDate: false, _removedHeader: {}, _contentLength: 0, _hasBody: true, _trailer: '', finished: true, _headerSent: true, socket: [Circular], connection: [Circular], _header: 'GET / HTTP/1.1\r\nHost: www.alba.co.kr\r\nConnection: close\r\n\r\n', _headers: [Object], _headerNames: [Object], _onPendingData: null, agent: [Object], socketPath: undefined, method: 'GET', path: '/', parser: null, res: [Circular] }, read: [Function], _consuming: true, _idleNext: null, _idlePrev: null, _idleTimeout: -1 }, _consuming: true, _dumped: false, req: ClientRequest { domain: null, _events: { socket: [Object], response: [Function: bound ], error: [Function: bound ], drain: [Function] }, _eventsCount: 4, _maxListeners: undefined, output: [], outputEncodings: [], outputCallbacks: [], outputSize: 0, writable: true, _last: true, chunkedEncoding: false, shouldKeepAlive: false, useChunkedEncodingByDefault: false, sendDate: false, _removedHeader: {}, _contentLength: 0, _hasBody: true, _trailer: '', finished: true, _headerSent: true, socket: Socket { _connecting: false, _hadError: false, _handle: null, _parent: null, _host: 'www.alba.co.kr', _readableState: [Object], readable: false, domain: null, _events: [Object], _eventsCount: 8, _maxListeners: 0, _writableState: [Object], writable: false, allowHalfOpen: false, destroyed: true, bytesRead: 363, _bytesDispatched: 59, _sockname: null, _pendingData: null, _pendingEncoding: '', server: null, _server: null, parser: null, _httpMessage: [Circular], read: [Function], _consuming: true, _idleNext: null, _idlePrev: null, _idleTimeout: -1 }, connection: Socket { _connecting: false, _hadError: false, _handle: null, _parent: null, _host: 'www.alba.co.kr', _readableState: [Object], readable: false, domain: null, _events: [Object], _eventsCount: 8, _maxListeners: 0, _writableState: [Object], writable: false, allowHalfOpen: false, destroyed: true, bytesRead: 363, _bytesDispatched: 59, _sockname: null, _pendingData: null, _pendingEncoding: '', server: null, _server: null, parser: null, _httpMessage: [Circular], read: [Function], _consuming: true, _idleNext: null, _idlePrev: null, _idleTimeout: -1 }, _header: 'GET / HTTP/1.1\r\nHost: www.alba.co.kr\r\nConnection: close\r\n\r\n', _headers: { host: 'www.alba.co.kr' }, _headerNames: { host: 'Host' }, _onPendingData: null, agent: Agent { domain: null, _events: [Object], _eventsCount: 1, _maxListeners: undefined, defaultPort: 80, protocol: 'http:', options: [Object], requests: {}, sockets: [Object], freeSockets: {}, keepAliveMsecs: 1000, keepAlive: false, maxSockets: Infinity, maxFreeSockets: 256 }, socketPath: undefined, method: 'GET', path: '/', parser: null, res: [Circular] }, request: Request { domain: null, _events: { error: [Function: bound ], complete: [Function: bound ], pipe: [Function], end: [Object], data: [Function] }, _eventsCount: 5, _maxListeners: undefined, uri: Url { protocol: 'http:', slashes: true, auth: null, host: 'www.alba.co.kr', port: 80, hostname: 'www.alba.co.kr', hash: null, search: null, query: null, pathname: '/', path: '/', href: 'http://www.alba.co.kr/' }, headers: { Host: 'www.alba.co.kr' }, callback: [Function], method: 'GET', readable: true, writable: true, explicitMethod: true, _qs: Querystring { request: [Circular], lib: [Object], useQuerystring: undefined, parseOptions: {}, stringifyOptions: {} }, _auth: Auth { request: [Circular], hasAuth: false, sentAuth: false, bearerToken: null, user: null, pass: null }, _oauth: OAuth { request: [Circular], params: null }, _multipart: Multipart { request: [Circular], boundary: '3a72a132-c63b-4458-b219-5d996b94b63c', chunked: false, body: null }, _redirect: Redirect { request: [Circular], followRedirect: true, followRedirects: true, followAllRedirects: false, allowRedirect: [Function], maxRedirects: 10, redirects: [], redirectsFollowed: 0, removeRefererHeader: false }, _tunnel: Tunnel { request: [Circular], proxyHeaderWhiteList: [Object], proxyHeaderExclusiveList: [] }, setHeader: [Function], hasHeader: [Function], getHeader: [Function], removeHeader: [Function], localAddress: undefined, pool: {}, dests: [], __isRequestRequest: true, _callback: [Function], proxy: null, tunnel: false, setHost: false, originalCookieHeader: undefined, _disableCookies: true, _jar: undefined, port: 80, host: 'www.alba.co.kr', path: '/', httpModule: { IncomingMessage: [Object], METHODS: [Object], OutgoingMessage: [Object], ServerResponse: [Object], STATUS_CODES: [Object], Agent: [Object], globalAgent: [Object], ClientRequest: [Object], request: [Function], get: [Function], _connectionListener: [Function: connectionListener], Server: [Object], createServer: [Function], Client: [Function: deprecated], createClient: [Function: deprecated] }, agentClass: { [Function: Agent] super_: [Object], defaultMaxSockets: Infinity }, agent: Agent { domain: null, _events: [Object], _eventsCount: 1, _maxListeners: undefined, defaultPort: 80, protocol: 'http:', options: [Object], requests: {}, sockets: [Object], freeSockets: {}, keepAliveMsecs: 1000, keepAlive: false, maxSockets: Infinity, maxFreeSockets: 256 }, _started: true, href: 'http://www.alba.co.kr/', req: ClientRequest { domain: null, _events: [Object], _eventsCount: 4, _maxListeners: undefined, output: [], outputEncodings: [], outputCallbacks: [], outputSize: 0, writable: true, _last: true, chunkedEncoding: false, shouldKeepAlive: false, useChunkedEncodingByDefault: false, sendDate: false, _removedHeader: {}, _contentLength: 0, _hasBody: true, _trailer: '', finished: true, _headerSent: true, socket: [Object], connection: [Object], _header: 'GET / HTTP/1.1\r\nHost: www.alba.co.kr\r\nConnection: close\r\n\r\n', _headers: [Object], _headerNames: [Object], _onPendingData: null, agent: [Object], socketPath: undefined, method: 'GET', path: '/', parser: null, res: [Circular] }, ntick: true, response: [Circular], originalHost: 'www.alba.co.kr', originalHostHeaderName: 'Host', responseContent: [Circular], _ended: true, _callbackCalled: true }, toJSON: [Function: responseToJSON], caseless: Caseless { dict: { 'cache-control': 'Private', pragma: 'No-Cache', 'content-length': '0', 'content-type': 'text/html; Charset=euc-kr', expires: 'Thu, 16 Jun 2016 17:50:54 GMT', server: 'Microsoft-IIS/7.5', 'set-cookie': [Object], 'x-powered-by': 'ASP.NET', date: 'Thu, 16 Jun 2016 17:51:53 GMT', connection: 'close' } }, read: [Function], body: '' }
|
erorr log¸¦ ºÁ¾ß ¿À·ù¿øÀÎÀ» ¾Ë ¼ö ÀÖ½À´Ï´Ù.
error log°¡ ¾ø´Ù¸é request°¡ ½ÇÆÐ ÇßÀ» ¼ö ÀÖÀ¸´Ï body´ë½Å errÀ̶û response¸¦ °°ÀÌ Âï¾îº¸¼¼¿ä.
±×·¡¼ ÀÌÀ¯¸¦ ¸ð¸£°Ú½À´Ï´Ù.¤Ð
error code°¡ ÀÖÀ¸¸é º¸°í ¼öÁ¤À» ÇÒÅÙµ¥¤Ð
responseµµ ÷ºÎÇÕ´Ï´Ù.
================================
var request = require(\"request\");
request(\"http://www.alba.co.kr/\", function(error, response, body) {
console.log(body);
});
statusMessage´Â OK±¸¿ä. À½..¤Ð