From f7a749da0979efcf9c4f121f80c01390c87519da Mon Sep 17 00:00:00 2001 From: Richard Willis Date: Mon, 1 Jun 2020 21:20:22 +0100 Subject: [PATCH] grpc-js: Add support for grpc.enable_http_proxy channel option --- PACKAGE-COMPARISON.md | 1 + packages/grpc-js/src/channel-options.ts | 2 ++ packages/grpc-js/src/http_proxy.ts | 3 +++ 3 files changed, 6 insertions(+) diff --git a/PACKAGE-COMPARISON.md b/PACKAGE-COMPARISON.md index 46c28b02a..8bea1fd08 100644 --- a/PACKAGE-COMPARISON.md +++ b/PACKAGE-COMPARISON.md @@ -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` diff --git a/packages/grpc-js/src/channel-options.ts b/packages/grpc-js/src/channel-options.ts index 89eb46cf0..8c4756ec7 100644 --- a/packages/grpc-js/src/channel-options.ts +++ b/packages/grpc-js/src/channel-options.ts @@ -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; } @@ -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( diff --git a/packages/grpc-js/src/http_proxy.ts b/packages/grpc-js/src/http_proxy.ts index df9ea09f2..0116145b1 100644 --- a/packages/grpc-js/src/http_proxy.ts +++ b/packages/grpc-js/src/http_proxy.ts @@ -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;