@n1k1t/mock-server
Version:
The ultimate toolkit to intercept, transform, and simulate HTTP/WS traffic with type-safe expectations
23 lines • 1.31 kB
TypeScript
import type { Expectation, IExpectationSchemaForward } from '../../../expectations';
import { RequestContext, IRequestContextOutgoing, IRequestContextIncoming, IRequestContextForwarded } from '../context';
export * from './errors';
export interface IExecutorExecOptions {
expectation?: Expectation;
}
export declare abstract class Executor<TRequestContext extends RequestContext = RequestContext> {
TRequestContext: TRequestContext;
TContext: TRequestContext['TContext'];
/** Uses to handle request forwarding */
abstract forward(context: TRequestContext, incoming: IRequestContextIncoming, schema: IExpectationSchemaForward): Promise<IRequestContextForwarded | null>;
/** Uses to handle outgoing payload and reply */
abstract reply(context: TRequestContext, outgoing: IRequestContextOutgoing): Promise<IRequestContextOutgoing | null>;
/** Matches expectation */
match(context: TRequestContext): Promise<Expectation | null>;
/** Prepares context right after expectation was manipulated */
prepare(context: TRequestContext): Promise<unknown>;
/** Uses to handle whole request */
exec(context: TRequestContext, options?: IExecutorExecOptions): Promise<TRequestContext>;
private handleForwarding;
private handleReplying;
}
//# sourceMappingURL=index.d.ts.map