grpc-js: Add support for grpc.enable_http_proxy channel option

This commit is contained in:
Richard Willis 2020-06-01 21:20:22 +01:00
parent 4946b418b4
commit f7a749da09
3 changed files with 6 additions and 0 deletions

View File

@ -43,5 +43,6 @@ In addition, all channel arguments defined in [this header file](https://github.
- `grpc.use_local_subchannel_pool` - `grpc.use_local_subchannel_pool`
- `grpc.max_send_message_length` - `grpc.max_send_message_length`
- `grpc.max_receive_message_length` - `grpc.max_receive_message_length`
- `grpc.enable_http_proxy`
- `channelOverride` - `channelOverride`
- `channelFactoryOverride` - `channelFactoryOverride`

View File

@ -32,6 +32,7 @@ export interface ChannelOptions {
'grpc.use_local_subchannel_pool'?: number; 'grpc.use_local_subchannel_pool'?: number;
'grpc.max_send_message_length'?: number; 'grpc.max_send_message_length'?: number;
'grpc.max_receive_message_length'?: number; 'grpc.max_receive_message_length'?: number;
'grpc.enable_http_proxy'?: number;
[key: string]: string | number | undefined; [key: string]: string | number | undefined;
} }
@ -53,6 +54,7 @@ export const recognizedOptions = {
'grpc.use_local_subchannel_pool': true, 'grpc.use_local_subchannel_pool': true,
'grpc.max_send_message_length': true, 'grpc.max_send_message_length': true,
'grpc.max_receive_message_length': true, 'grpc.max_receive_message_length': true,
'grpc.enable_http_proxy': true,
}; };
export function channelOptionsEqual( export function channelOptionsEqual(

View File

@ -125,6 +125,9 @@ export function mapProxyName(
target: target, target: target,
extraOptions: {}, extraOptions: {},
}; };
if ((options['grpc.enable_http_proxy'] ?? 1) === 0) {
return noProxyResult;
}
const proxyInfo = getProxyInfo(); const proxyInfo = getProxyInfo();
if (!proxyInfo.address) { if (!proxyInfo.address) {
return noProxyResult; return noProxyResult;