Skip to content

Commit

Permalink
Merge pull request #1454 from badsyntax/enable_http_proxy
Browse files Browse the repository at this point in the history
grpc-js: Add support for grpc.enable_http_proxy channel option
  • Loading branch information
murgatroid99 committed Jun 1, 2020
2 parents f309912 + f7a749d commit 136626a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions PACKAGE-COMPARISON.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,6 @@ In addition, all channel arguments defined in [this header file](https://github.
- `grpc.use_local_subchannel_pool`
- `grpc.max_send_message_length`
- `grpc.max_receive_message_length`
- `grpc.enable_http_proxy`
- `channelOverride`
- `channelFactoryOverride`
2 changes: 2 additions & 0 deletions packages/grpc-js/src/channel-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export interface ChannelOptions {
'grpc.use_local_subchannel_pool'?: number;
'grpc.max_send_message_length'?: number;
'grpc.max_receive_message_length'?: number;
'grpc.enable_http_proxy'?: number;
[key: string]: string | number | undefined;
}

Expand All @@ -53,6 +54,7 @@ export const recognizedOptions = {
'grpc.use_local_subchannel_pool': true,
'grpc.max_send_message_length': true,
'grpc.max_receive_message_length': true,
'grpc.enable_http_proxy': true,
};

export function channelOptionsEqual(
Expand Down
3 changes: 3 additions & 0 deletions packages/grpc-js/src/http_proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ export function mapProxyName(
target: target,
extraOptions: {},
};
if ((options['grpc.enable_http_proxy'] ?? 1) === 0) {
return noProxyResult;
}
const proxyInfo = getProxyInfo();
if (!proxyInfo.address) {
return noProxyResult;
Expand Down

0 comments on commit 136626a

Please sign in to comment.