Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
path = '/thrift',
https = false,
transport = 'buffered',
protocol = 'binary',
requestOptions = {},
serviceName,
withEndpointPerMethod = false,
headerBlacklist = [],
}: IHttpConnectionOptions) {
super(Core.getTransport(transport), Core.getProtocol(protocol))
this.requestOptions = Object.freeze(
filterHeaders(requestOptions, headerBlacklist),
)
this.port = port
this.hostName = hostName
this.path = Core.normalizePath(path || DEFAULT_PATH)
this.protocol = https === true ? 'https' : 'http'
this.serviceName = serviceName
this.basePath = `${this.protocol}://${this.hostName}:${this.port}`
this.withEndpointPerMethod = withEndpointPerMethod
this.url = `${this.basePath}${this.path}`
this.filters = []
}
export function ThriftServerHapi<
TProcessor extends Core.IThriftProcessor
>(pluginOptions: IHapiPluginOptions): ThriftHapiPlugin {
const thriftOptions: IHapiServerOptions =
pluginOptions.thriftOptions
const logger: Core.LogFunction = thriftOptions.logger || defaultLogger
const thriftPath: string = Core.normalizePath(
pluginOptions.path || DEFAULT_PATH,
)
const serviceName: string = pluginOptions.thriftOptions.serviceName
const Transport: Core.ITransportConstructor = Core.getTransport(
thriftOptions.transport,
)
const Protocol: Core.IProtocolConstructor = Core.getProtocol(
thriftOptions.protocol,
)
const processor: Core.IThriftProcessor = thriftOptions.handler
const rawServiceName: string = processor._serviceName
return {
name: require('../../package.json').name,
version: require('../../package.json').version,