Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
options: ICreateHttpClientOptions,
): TClient {
let serviceName: string = ''
if ((ServiceClient as any).serviceName !== 'undefined') {
serviceName = (ServiceClient as any).serviceName
} else {
const nullConnection: NullConnection = new NullConnection(
BufferedTransport,
BinaryProtocol,
)
const nullClient: TClient = new ServiceClient(nullConnection)
serviceName = nullClient._serviceName
}
const connection: HttpConnection = new HttpConnection(
deepMerge(options, { serviceName }),
)
// Register optional middleware
connection.register(...(options.register || []))
return new ServiceClient(connection)
}
(
nextData?: Buffer,
nextOptions?: RequestOptions,
): Promise => {
const data: Buffer =
nextData !== undefined ? nextData : currentRequest.data
return applyFilters(
{
data,
methodName: currentRequest.methodName,
uri: currentRequest.uri,
context: Core.deepMerge(
currentRequest.context,
nextOptions || {},
),
},
tail,
callback,
)
},
)