UNPKG

kitejs

Version:

the rpc framework Kite for Node.js

28 lines (27 loc) 802 B
"use strict"; /** * @author xiangshouding * @file protocol/http.ts */ exports.__esModule = true; var request = require("request"); var Http = /** @class */ (function () { function Http(addr, options) { this.method = 'GET'; this.timeout = 2000; // 2s this.options = options || { method: 'GET' }; if (!this.options['url'] && !this.options['uri']) { var path = this.options['path'] || ''; path = (path.indexOf('/') === 0 ? '' : '/') + path; this.options['url'] = "http://" + addr.getAddress() + path; } } Http.prototype.createConnection = function () { }; Http.prototype.request = function (cb) { return request(this.options, cb); }; return Http; }()); exports.Http = Http;