Skip to content

Commit

Permalink
fix(host): cannot find RequestOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveVanOpstal committed May 24, 2016
1 parent 4cf62ec commit 95506be
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/server/host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ export module Host {
export let config = {
protocol: 'https://',
hostname: '.api.pvp.net',
// summoner: '/{{region}}/v1.4/summoner/',
// matchlist: '/{{region}}/v2.2/matchlist/',
// match: '/{{region}}/v2.2/match/',
apiKey: apiKey
};

Expand All @@ -48,7 +45,7 @@ export class Server {
'content-type': 'application/json'
};

private options: RequestOptions = {
private options: https.RequestOptions = {
hostname: 'global.api.pvp.net',
method: 'GET',
headers: {
Expand Down Expand Up @@ -84,7 +81,7 @@ export class Server {
public sendRequest(url: string, region: string, callback: (response: Host.Response) => void): void {
url = this.transformPath(url, region);

let options: RequestOptions = { path: url };
let options: https.RequestOptions = { path: url };
this.merge(this.options, options);

this.sendHttpsRequest(options, callback);
Expand All @@ -98,7 +95,7 @@ export class Server {
return this.cache.get(url);
}

private sendHttpsRequest(options: RequestOptions, callback: (response: Host.Response) => void) {
private sendHttpsRequest(options: https.RequestOptions, callback: (response: Host.Response) => void) {
let console = new ColorConsole();
let req = https.request(options, (res: IncomingMessage) => this.handleResponse(console, options, res, callback));
req.on('error', (e) => this.handleResponseError(console, options, e, callback));
Expand All @@ -112,7 +109,7 @@ export class Server {
req.end();
}

private handleResponse(console: ColorConsole, options: RequestOptions, res: IncomingMessage, callback: (response: Host.Response) => void) {
private handleResponse(console: ColorConsole, options: https.RequestOptions, res: IncomingMessage, callback: (response: Host.Response) => void) {
let data = '';
res.on('data', (d: string) => {
data += d;
Expand All @@ -122,7 +119,7 @@ export class Server {
});
}

private handleResponseSuccess(console: ColorConsole, options: RequestOptions, res: IncomingMessage, data: any, callback: (response: Host.Response) => void) {
private handleResponseSuccess(console: ColorConsole, options: https.RequestOptions, res: IncomingMessage, data: any, callback: (response: Host.Response) => void) {
let json = {};
try {
json = JSON.parse(data);
Expand Down Expand Up @@ -217,7 +214,7 @@ export class Server {

championUrl = this.addApiKey(championUrl);

let options: RequestOptions = { path: championUrl };
let options: https.RequestOptions = { path: championUrl };
this.merge(this.options, options);

this.sendHttpsRequest(options, (response: Host.Response) => {
Expand Down

0 comments on commit 95506be

Please sign in to comment.