mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Merge pull request #21585 from kevin-greene-ck/thrift-https
[thrift] connections should take options for http or https
This commit is contained in:
Vendored
+2
-1
@@ -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 {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import * as http from 'http';
|
||||
import * as https from 'https';
|
||||
|
||||
import {
|
||||
createConnection,
|
||||
@@ -43,18 +44,33 @@ const mockGeneratedService = {
|
||||
|
||||
createServer<MockProcessor, MockServiceHandlers>(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<MockClient>(mockGeneratedService, clientConnection);
|
||||
|
||||
const mockBuffer: Buffer = Buffer.alloc(8);
|
||||
|
||||
Reference in New Issue
Block a user