mockttp
Version:
Mock HTTP server for testing HTTP clients and stubbing webservices
42 lines • 2.34 kB
TypeScript
import { Buffer } from 'buffer';
import * as net from 'net';
import * as http from 'http';
import { ClientServerChannel } from '../../serialization/serialization';
import { MockttpDeserializationOptions } from '../rule-deserialization';
import { OngoingRequest } from "../../types";
import { RequestStepOptions, CloseConnectionStepImpl, DelayStepImpl, ResetConnectionStepImpl, TimeoutStepImpl } from '../requests/request-step-impls';
import { EchoWebSocketStep, ListenWebSocketStep, PassThroughWebSocketStep, PassThroughWebSocketStepOptions, RejectWebSocketStep, SerializedPassThroughWebSocketData, WebSocketStepDefinition, WsStepDefinitionLookup } from './websocket-step-definitions';
export interface WebSocketStepImpl extends WebSocketStepDefinition {
handle(request: OngoingRequest & http.IncomingMessage, socket: net.Socket, head: Buffer, options: RequestStepOptions): Promise<undefined | {
continue: boolean;
}>;
}
export { PassThroughWebSocketStepOptions };
export declare class PassThroughWebSocketStepImpl extends PassThroughWebSocketStep {
private wsServer?;
private initializeWsServer;
private _trustedCACertificates;
private trustedCACertificates;
handle(req: OngoingRequest, socket: net.Socket, head: Buffer, options: RequestStepOptions): Promise<void>;
private connectUpstream;
/**
* @internal
*/
static deserialize(data: SerializedPassThroughWebSocketData, channel: ClientServerChannel, { ruleParams }: MockttpDeserializationOptions): any;
}
export declare class EchoWebSocketStepImpl extends EchoWebSocketStep {
private wsServer?;
private initializeWsServer;
handle(req: OngoingRequest & http.IncomingMessage, socket: net.Socket, head: Buffer): Promise<void>;
}
export declare class ListenWebSocketStepImpl extends ListenWebSocketStep {
private wsServer?;
private initializeWsServer;
handle(req: OngoingRequest & http.IncomingMessage, socket: net.Socket, head: Buffer): Promise<void>;
}
export declare class RejectWebSocketStepImpl extends RejectWebSocketStep {
handle(req: OngoingRequest, socket: net.Socket): Promise<void>;
}
export { CloseConnectionStepImpl, ResetConnectionStepImpl, TimeoutStepImpl, DelayStepImpl };
export declare const WsStepLookup: typeof WsStepDefinitionLookup;
//# sourceMappingURL=websocket-step-impls.d.ts.map