Skip to content

Commit 9345cd9

Browse files
committed
[Issue #187] Add HttpClient::request for proxy
1 parent 37c9c29 commit 9345cd9

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
## [3.1.0] Aug-06-2019
44

5+
### Additions
6+
- [Issue #187] Add HttpClient::request for proxy
7+
58
### Fixes
69
- npm update
710

src/http/http-client.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import * as request from 'request';
1616
import { HttpClientResponse } from './http-client-response';
1717

1818
export class HttpClient {
19+
public request = request;
20+
1921
// Server URL
2022
public url = 'http://localhost';
2123

@@ -48,7 +50,7 @@ export class HttpClient {
4850
}
4951

5052
return new Promise<HttpClientResponse>((accept, reject) => {
51-
request(options, (error, response, body) => {
53+
this.request(options, (error, response, body) => {
5254
if (error) {
5355
reject(new HttpClientResponse(response, error));
5456
}
@@ -93,7 +95,7 @@ export class HttpClient {
9395
options['auth'] = { bearer: `${bearer}` };
9496
}
9597

96-
request(options, (error, response, body) => {
98+
this.request(options, (error, response, body) => {
9799
if (error) {
98100
reject(new HttpClientResponse(response, error));
99101
}
@@ -138,7 +140,7 @@ export class HttpClient {
138140
}
139141

140142
return new Promise<HttpClientResponse>((accept, reject) => {
141-
request(options, (error, response, body) => {
143+
this.request(options, (error, response, body) => {
142144
if (error) {
143145
reject(new HttpClientResponse(response, error));
144146
}
@@ -180,7 +182,7 @@ export class HttpClient {
180182
options['auth'] = { bearer: `${bearer}` };
181183
}
182184

183-
request(options, (error, response, body) => {
185+
this.request(options, (error, response, body) => {
184186
if (error) {
185187
reject(new HttpClientResponse(response, error));
186188
}

0 commit comments

Comments
 (0)