1 line
6.5 KiB
JSON
1 line
6.5 KiB
JSON
{"ast":null,"code":"var ClientRequest = require('./lib/request');\n\nvar response = require('./lib/response');\n\nvar extend = require('xtend');\n\nvar statusCodes = require('builtin-status-codes');\n\nvar url = require('url');\n\nvar http = exports;\n\nhttp.request = function (opts, cb) {\n if (typeof opts === 'string') opts = url.parse(opts);else opts = extend(opts); // Normally, the page is loaded from http or https, so not specifying a protocol\n // will result in a (valid) protocol-relative url. However, this won't work if\n // the protocol is something else, like 'file:'\n\n var defaultProtocol = global.location.protocol.search(/^https?:$/) === -1 ? 'http:' : '';\n var protocol = opts.protocol || defaultProtocol;\n var host = opts.hostname || opts.host;\n var port = opts.port;\n var path = opts.path || '/'; // Necessary for IPv6 addresses\n\n if (host && host.indexOf(':') !== -1) host = '[' + host + ']'; // This may be a relative url. The browser should always be able to interpret it correctly.\n\n opts.url = (host ? protocol + '//' + host : '') + (port ? ':' + port : '') + path;\n opts.method = (opts.method || 'GET').toUpperCase();\n opts.headers = opts.headers || {}; // Also valid opts.auth, opts.mode\n\n var req = new ClientRequest(opts);\n if (cb) req.on('response', cb);\n return req;\n};\n\nhttp.get = function get(opts, cb) {\n var req = http.request(opts, cb);\n req.end();\n return req;\n};\n\nhttp.ClientRequest = ClientRequest;\nhttp.IncomingMessage = response.IncomingMessage;\n\nhttp.Agent = function () {};\n\nhttp.Agent.defaultMaxSockets = 4;\nhttp.globalAgent = new http.Agent();\nhttp.STATUS_CODES = statusCodes;\nhttp.METHODS = ['CHECKOUT', 'CONNECT', 'COPY', 'DELETE', 'GET', 'HEAD', 'LOCK', 'M-SEARCH', 'MERGE', 'MKACTIVITY', 'MKCOL', 'MOVE', 'NOTIFY', 'OPTIONS', 'PATCH', 'POST', 'PROPFIND', 'PROPPATCH', 'PURGE', 'PUT', 'REPORT', 'SEARCH', 'SUBSCRIBE', 'TRACE', 'UNLOCK', 'UNSUBSCRIBE'];","map":{"version":3,"sources":["/Users/tylerkoenig/Code/personal/react-scss2/node_modules/stream-http/index.js"],"names":["ClientRequest","require","response","extend","statusCodes","url","http","exports","request","opts","cb","parse","defaultProtocol","global","location","protocol","search","host","hostname","port","path","indexOf","method","toUpperCase","headers","req","on","get","end","IncomingMessage","Agent","defaultMaxSockets","globalAgent","STATUS_CODES","METHODS"],"mappings":"AAAA,IAAIA,aAAa,GAAGC,OAAO,CAAC,eAAD,CAA3B;;AACA,IAAIC,QAAQ,GAAGD,OAAO,CAAC,gBAAD,CAAtB;;AACA,IAAIE,MAAM,GAAGF,OAAO,CAAC,OAAD,CAApB;;AACA,IAAIG,WAAW,GAAGH,OAAO,CAAC,sBAAD,CAAzB;;AACA,IAAII,GAAG,GAAGJ,OAAO,CAAC,KAAD,CAAjB;;AAEA,IAAIK,IAAI,GAAGC,OAAX;;AAEAD,IAAI,CAACE,OAAL,GAAe,UAAUC,IAAV,EAAgBC,EAAhB,EAAoB;AAClC,MAAI,OAAOD,IAAP,KAAgB,QAApB,EACCA,IAAI,GAAGJ,GAAG,CAACM,KAAJ,CAAUF,IAAV,CAAP,CADD,KAGCA,IAAI,GAAGN,MAAM,CAACM,IAAD,CAAb,CAJiC,CAMlC;AACA;AACA;;AACA,MAAIG,eAAe,GAAGC,MAAM,CAACC,QAAP,CAAgBC,QAAhB,CAAyBC,MAAzB,CAAgC,WAAhC,MAAiD,CAAC,CAAlD,GAAsD,OAAtD,GAAgE,EAAtF;AAEA,MAAID,QAAQ,GAAGN,IAAI,CAACM,QAAL,IAAiBH,eAAhC;AACA,MAAIK,IAAI,GAAGR,IAAI,CAACS,QAAL,IAAiBT,IAAI,CAACQ,IAAjC;AACA,MAAIE,IAAI,GAAGV,IAAI,CAACU,IAAhB;AACA,MAAIC,IAAI,GAAGX,IAAI,CAACW,IAAL,IAAa,GAAxB,CAdkC,CAgBlC;;AACA,MAAIH,IAAI,IAAIA,IAAI,CAACI,OAAL,CAAa,GAAb,MAAsB,CAAC,CAAnC,EACCJ,IAAI,GAAG,MAAMA,IAAN,GAAa,GAApB,CAl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AWd,OAXc,EAYd,MAZc,EAad,QAbc,EAcd,SAdc,EAed,OAfc,EAgBd,MAhBc,EAiBd,UAjBc,EAkBd,WAlBc,EAmBd,OAnBc,EAoBd,KApBc,EAqBd,QArBc,EAsBd,QAtBc,EAuBd,WAvBc,EAwBd,OAxBc,EAyBd,QAzBc,EA0Bd,aA1Bc,CAAf","sourcesContent":["var ClientRequest = require('./lib/request')\nvar response = require('./lib/response')\nvar extend = require('xtend')\nvar statusCodes = require('builtin-status-codes')\nvar url = require('url')\n\nvar http = exports\n\nhttp.request = function (opts, cb) {\n\tif (typeof opts === 'string')\n\t\topts = url.parse(opts)\n\telse\n\t\topts = extend(opts)\n\n\t// Normally, the page is loaded from http or https, so not specifying a protocol\n\t// will result in a (valid) protocol-relative url. However, this won't work if\n\t// the protocol is something else, like 'file:'\n\tvar defaultProtocol = global.location.protocol.search(/^https?:$/) === -1 ? 'http:' : ''\n\n\tvar protocol = opts.protocol || defaultProtocol\n\tvar host = opts.hostname || opts.host\n\tvar port = opts.port\n\tvar path = opts.path || '/'\n\n\t// Necessary for IPv6 addresses\n\tif (host && host.indexOf(':') !== -1)\n\t\thost = '[' + host + ']'\n\n\t// This may be a relative url. The browser should always be able to interpret it correctly.\n\topts.url = (host ? (protocol + '//' + host) : '') + (port ? ':' + port : '') + path\n\topts.method = (opts.method || 'GET').toUpperCase()\n\topts.headers = opts.headers || {}\n\n\t// Also valid opts.auth, opts.mode\n\n\tvar req = new ClientRequest(opts)\n\tif (cb)\n\t\treq.on('response', cb)\n\treturn req\n}\n\nhttp.get = function get (opts, cb) {\n\tvar req = http.request(opts, cb)\n\treq.end()\n\treturn req\n}\n\nhttp.ClientRequest = ClientRequest\nhttp.IncomingMessage = response.IncomingMessage\n\nhttp.Agent = function () {}\nhttp.Agent.defaultMaxSockets = 4\n\nhttp.globalAgent = new http.Agent()\n\nhttp.STATUS_CODES = statusCodes\n\nhttp.METHODS = [\n\t'CHECKOUT',\n\t'CONNECT',\n\t'COPY',\n\t'DELETE',\n\t'GET',\n\t'HEAD',\n\t'LOCK',\n\t'M-SEARCH',\n\t'MERGE',\n\t'MKACTIVITY',\n\t'MKCOL',\n\t'MOVE',\n\t'NOTIFY',\n\t'OPTIONS',\n\t'PATCH',\n\t'POST',\n\t'PROPFIND',\n\t'PROPPATCH',\n\t'PURGE',\n\t'PUT',\n\t'REPORT',\n\t'SEARCH',\n\t'SUBSCRIBE',\n\t'TRACE',\n\t'UNLOCK',\n\t'UNSUBSCRIBE'\n]"]},"metadata":{},"sourceType":"script"} |