diff --git a/types/thrift/index.d.ts b/types/thrift/index.d.ts index a082c309ad..c5cb6f20a3 100644 --- a/types/thrift/index.d.ts +++ b/types/thrift/index.d.ts @@ -10,6 +10,7 @@ import * as net from 'net'; import * as http from 'http'; +import * as https from 'https'; import * as tls from 'tls'; // Thrift re-exports node-int64 and Q @@ -249,7 +250,7 @@ export interface ConnectOptions { retry_max_delay?: number; connect_timeout?: number; timeout?: number; - nodeOptions?: http.RequestOptions; + nodeOptions?: http.RequestOptions | https.RequestOptions; } export interface WSConnectOptions { diff --git a/types/thrift/thrift-tests.ts b/types/thrift/thrift-tests.ts index f888f28086..385a1051b9 100644 --- a/types/thrift/thrift-tests.ts +++ b/types/thrift/thrift-tests.ts @@ -1,4 +1,5 @@ import * as http from 'http'; +import * as https from 'https'; import { createConnection, @@ -43,18 +44,33 @@ const mockGeneratedService = { createServer(mockGeneratedService, mockServiceHandlers); -const nodeOptions: http.RequestOptions = { +const httpOptions: http.RequestOptions = { timeout: 10000, headers: { 'Content-Type': 'application/octet-stream' } }; +const httpsOptions: https.RequestOptions = { + timeout: 10000, + headers: { + 'Content-Type': 'application/octet-stream' + }, + secureProtocol: 'SSLv3_method' +}; + const clientConnection = createConnection('0.0.0.0', 1234, { - transport: TBufferedTransport, - protocol: TBinaryProtocol, - nodeOptions + transport: TBufferedTransport, + protocol: TBinaryProtocol, + nodeOptions: httpOptions }); + +const secureConnection = createConnection('0.0.0.0', 1234, { + transport: TBufferedTransport, + protocol: TBinaryProtocol, + nodeOptions: httpsOptions +}); + createClient(mockGeneratedService, clientConnection); const mockBuffer: Buffer = Buffer.alloc(8);